% content_for :sidebar do %>
<%= render :partial => 'body_trackers/sidebar' %>
<% end %>
<% if User.current.allowed_to?(:manage_common, @project) %>
<%= link_to t(".heading_import_ingredients"), '#', :class => 'icon icon-file',
:onclick => 'showAndScrollTo("import-ingredients", "filename"); return false;' %>
<%= link_to t(".heading_new_ingredient"), '#', :class => 'icon icon-add',
:onclick => 'showAndScrollTo("add-ingredient", "ingredient_name"); return false;' %>
<% end %>
<%= t ".heading_import_ingredients" %>
<%= form_tag import_project_ingredients_path(@project),
:multipart => true,
:id => 'import-form' do %>
<%= file_field_tag 'file' %>
<%= t ".import_hints" %>
<%= submit_tag l(:button_import) %>
<%= link_to l(:button_cancel), "#", :onclick => '$("#import-ingredients").hide()' %>
<% end %>
>
<%= t ".heading_new_ingredient" %>
<%= labelled_form_for @ingredient,
:url => project_ingredients_path(@project),
:html => {:id => 'ingredient-form'} do |f| %>
<%= render :partial => 'ingredients/form', :locals => { :f => f } %>
<%= submit_tag l(:button_create) %>
<%= link_to l(:button_cancel), "#", :onclick => '$("#add-ingredient").hide()' %>
<% end %>
<%= t ".heading" %>
<% if @ingredients.any? %>
<%= l(:field_name) %> |
<%= l(:field_ref_amount) %> |
<%= l(:field_group) %> |
<%= l(:field_source) %> |
<%= l(:field_action) %> |
<% @ingredients.each do |i| %>
<%= i.name %> |
<%= i.ref_amount %> [<%= i.ref_unit.shortname %>] |
<%= i.group %> |
<%#= i.source %> |
<%= delete_link ingredient_path(i), data: {} %> |
<% end %>
<% else %>
<%= l(:label_no_data) %>
<% end %>