<% 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 %>
>
<%= t ".heading_new_unit" %>
<%= 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 %>
<%= title t(:body_trackers_title), t(".heading") %>
<% if @units.any? { |u| u.persisted? } %>
<%= l(:field_shortname) %> |
<%= l(:field_name) %> |
<%= l(:field_action) %> |
<% @units.each do |u| %>
<% next if u.new_record? %>
<%= u.shortname %> |
<%= u.name %> |
<%= delete_link unit_path(u), data: {} %> |
<% end %>
<% else %>
<%= l(:label_no_data) %>
<% end %>