94 lines
3.2 KiB
Plaintext
94 lines
3.2 KiB
Plaintext
<% content_for :sidebar do %>
|
|
<%= render :partial => 'body_trackers/sidebar' %>
|
|
<% end %>
|
|
|
|
<div class="contextual">
|
|
<% if User.current.allowed_to?(:manage_common, @project) %>
|
|
<%= link_to t(".heading_new_quantity"), '#', :class => 'icon icon-add',
|
|
:onclick => 'showAndScrollTo("add-quantity", "quantity_name"); return false;' %>
|
|
<% end %>
|
|
</div>
|
|
|
|
<div id="add-quantity" <%= 'style=display:none;' if @quantity.errors.empty? %>>
|
|
<h2><%= t ".heading_new_quantity" %></h2>
|
|
|
|
<%= labelled_form_for @quantity,
|
|
:url => project_quantities_path(@project),
|
|
:html => {:id => 'quantity-form'} do |f| %>
|
|
<%= render :partial => 'quantities/form', :locals => { :f => f } %>
|
|
<%= submit_tag l(:button_create) %>
|
|
<%= link_to l(:button_cancel), "#", :onclick => '$("#add-quantity").hide()' %>
|
|
<% end %>
|
|
<hr>
|
|
</div>
|
|
|
|
<h2><%= t ".heading" %></h2>
|
|
<% if @quantities.many? %>
|
|
<table class="list">
|
|
<thead>
|
|
<tr>
|
|
<th><%= l(:field_name) %></th>
|
|
<th><%= l(:field_order) %></th>
|
|
<th><%= l(:field_domain) %></th>
|
|
<th><%= l(:field_description) %></th>
|
|
<th><%= l(:field_action) %></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<% Quantity.each_with_level(@quantities) do |q, level| %>
|
|
<%
|
|
next if q.new_record?
|
|
quantity_class = "quantity"
|
|
quantity_class += " project idnt idnt-#{level+1}"
|
|
quantity_class += " primary" if q.primary
|
|
%>
|
|
<tr id="quantity-<%= q.id %>" class="<%= quantity_class %>">
|
|
<td class="name">
|
|
<%= link_to '', toggle_quantity_path(q),
|
|
{method: :post, class: "icon #{q.primary ? "icon-fav" : "icon-fav-off"}"} %>
|
|
<%= q.name %>
|
|
</td>
|
|
<td class="order">
|
|
<%=
|
|
if q.left_sibling.present?
|
|
link_to '', up_quantity_path(q), {method: :post, class: "icon icon-move-up"}
|
|
else
|
|
link_to '', '', {class: "icon"}
|
|
end
|
|
%>
|
|
<%=
|
|
if q.right_sibling.present?
|
|
link_to '', down_quantity_path(q),
|
|
{method: :post, class: "icon icon-move-down"}
|
|
else
|
|
link_to '', '', {class: "icon"}
|
|
end
|
|
%>
|
|
<%=
|
|
if q.parent.present?
|
|
link_to '', left_quantity_path(q),
|
|
{method: :post, class: "icon icon-move-left"}
|
|
else
|
|
link_to '', '', {class: "icon"}
|
|
end
|
|
%>
|
|
<%=
|
|
if q.left_sibling.present?
|
|
link_to '', right_quantity_path(q),
|
|
{method: :post, class: "icon icon-move-right"}
|
|
else
|
|
link_to '', '', {class: "icon"}
|
|
end
|
|
%>
|
|
</td>
|
|
<td class="domain"><%= q.domain %></td>
|
|
<td class="description"><%= q.description %></td>
|
|
<td class="action"><%= delete_link quantity_path(q), data: {} %></td>
|
|
</tr>
|
|
<% end %>
|
|
</tbody>
|
|
</table>
|
|
<% else %>
|
|
<p class="nodata"><%= l(:label_no_data) %></p>
|
|
<% end %>
|