46 lines
1.4 KiB
Plaintext
46 lines
1.4 KiB
Plaintext
<div class="contextual">
|
|
<% if User.current.allowed_to?(:manage_body_trackers, @project) %>
|
|
<%= link_to t(".link_new_unit"), '#', class: 'icon icon-add',
|
|
onclick: '$("#add-unit").show(); $("#unit_shortname").focus(); return false;' %>
|
|
<% end %>
|
|
</div>
|
|
|
|
<div id="add-unit" <%= 'style=display:none;' if @unit.errors.empty? %>>
|
|
<h2><%= t ".heading_new_unit" %></h2>
|
|
|
|
<%= labelled_form_for @unit,
|
|
url: project_units_path(@project),
|
|
html: {id: 'unit-add-form', name: 'unit-add-form'} do |f| %>
|
|
|
|
<%= render partial: 'units/form', locals: {f: f} %>
|
|
<%= submit_tag l(:button_create) %>
|
|
<%= link_to l(:button_cancel), "#", onclick: '$("#add-unit").hide(); return false;' %>
|
|
<% end %>
|
|
<hr>
|
|
</div>
|
|
|
|
<%= title t(:body_trackers_title), t(".heading") %>
|
|
<% if @units.any? { |u| u.persisted? } %>
|
|
<table class="list">
|
|
<thead>
|
|
<tr>
|
|
<th><%= l(:field_shortname) %></th>
|
|
<th><%= l(:field_name) %></th>
|
|
<th style="width:5%"><%= l(:field_action) %></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<% @units.each do |u| %>
|
|
<% next if u.new_record? %>
|
|
<tr id="unit-<%= u.id %>" class="unit">
|
|
<td class="shortname"><%= u.shortname %></td>
|
|
<td class="unitname"><%= u.name %></td>
|
|
<td class="action"><%= delete_link unit_path(u), data: {} %></td>
|
|
</tr>
|
|
<% end %>
|
|
</tbody>
|
|
</table>
|
|
<% else %>
|
|
<p class="nodata"><%= l(:label_no_data) %></p>
|
|
<% end %>
|