/
_part.html.erb
45 lines (40 loc) · 1.84 KB
/
_part.html.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<div class="panel panel-part part">
<div class="panel-heading js-sort-handle">
<h4 class="panel-title">
<a class="js-part-toggle" data-toggle="collapse" data-parent="#parts" href="#<%= f.object.slug || 'untitled-part' %>">
<i class="glyphicon glyphicon-chevron-down pull-left add-right-margin"></i>
<span class="js-part-title"><%= f.object.title.present? ? f.object.title : 'Untitled part' %></span>
</a>
</h4>
</div>
<div id="<%= f.object.slug || 'untitled-part' %>" class="js-part-toggle-target panel-collapse collapse in" aria-expanded="true">
<div class="panel-body">
<%= f.inputs do %>
<%= f.input :title,
:input_html => { :class => 'title', :disabled => @resource.locked_for_edits? },
:hint => false,
:required => true %>
<%
slug_input_html = { :class => 'slug', :disabled => ! editable }
if @resource.version_number == 1
slug_input_html['data-accepts-generated-value'] = true
end
%>
<%= f.input :slug,
:input_html => slug_input_html,
:hint => true,
:required => true %>
<%= f.input :body,
:as => :text,
:required => true,
:input_html => {:rows => '25', :disabled => @resource.locked_for_edits? } %>
<%= f.input :order, :as => :hidden, :input_html => { :class => 'order', :disabled => !editable } %>
<% unless @resource.locked_for_edits? %>
<%= f.link_to_remove class: 'btn btn-default btn-sm' do %>
<i class="glyphicon glyphicon-remove glyphicon-smaller-than-text"></i> Remove this part
<% end %>
<% end %>
<% end %>
</div>
</div>
</div>