notebook/app/views/content/_form.html.erb
2018-09-21 16:01:43 -05:00

57 lines
2.3 KiB
Plaintext

<div style="padding: 35px 20px;">
<%= render 'content/form/errors', content: content %>
<%# Content panels %>
<% content.class.attribute_categories(@content.persisted? ? @content.user : current_user).each do |category| %>
<%= render 'content/form/panel', category: category, f: f, content: content %>
<% end %>
</div>
<div class="card-action center grey-text">
Tip: You don't need to save before changing categories (on the right). Just remember to save when you're done!
</div>
<div id="content-field-link-bar-template">
<div class="content-field-link-bar">
<div class="btn-group" role="group">
<span class="grey-text" style="padding-top: 6px; padding-right: 4px;">
Link a page (<a href="#" class="tooltipped" data-tooltip="These links will insert a small snippet that<br />automatically turns into a link to that page after saving." data-position="bottom" data-html="true">?</a>):
</span>
<% @linkables_cache.keys.each do |class_name| %>
<% relation_class = class_name.constantize %>
<a class="btn btn-small <%= relation_class.color %> dropdown-trigger <%= 'disabled' unless @linkables_cache.fetch(class_name, []).any? %> tooltipped"
href="#" style="padding: 0 9px;"
data-target='active_link_bar_<%= class_name %>'
data-tooltip="<%= class_name.pluralize %>"
data-position="bottom"
tabindex="-1">
<i class="material-icons">
<%= relation_class.icon %>
</i>
</a>
<ul id='active_link_bar_<%= class_name %>' class='dropdown-content'>
<%
@linkables_cache[class_name].each do |linkable|
%>
<li>
<a href="#" data-content-type="<%= class_name %>" data-content-id="<%= linkable.second %>" class="js-content-link-option">
<i class="material-icons <%= relation_class.color %>-text"><%= relation_class.icon %></i>
<%= linkable.first %>
</a>
</li>
<%
end
%>
</ul>
<% end %>
</div>
</div>
</div>
<%= content_for :javascript do %>
// todo hack this might be fixed with the latest materialize -- we should check
$('.field_with_errors').find('textarea, input').addClass('invalid');
<% end %>