1
0
This repository has been archived on 2023-12-07. You can view files and clone it, but cannot push or open issues or pull requests.
body_tracking/app/views/ingredients/nutrients.html.erb
2019-10-28 22:08:05 +01:00

54 lines
1.7 KiB
Plaintext

<% content_for :sidebar do %>
<%= render :partial => 'body_trackers/sidebar' %>
<% end %>
<div class="contextual">
<%= link_to t(".heading_ingredient_list"), project_ingredients_path(@project),
:class => 'icon icon-list' %>
<%= render :partial => 'ingredients/contextual' %>
</div>
<%= render :partial => 'ingredients/import' %>
<%= render :partial => 'ingredients/form' %>
<h2><%= t ".heading" %></h2>
<% if @nutrients.any? %>
<table class="nutrients list">
<thead>
<tr>
<th><%= l(:field_name) %></th>
<% @header.each do |q| %>
<th><%= q.name %></th>
<% end %>
</tr>
</thead>
<tbody>
<% @nutrients.each do |i, values| %>
<tr id="ingredient-<%= i.id %>" class="ingredient <%= 'hidden' if i.hidden %>">
<td class="name">
<%= link_to '', '#', {
onclick: "$(this).closest('tr').next('tr').toggle(); $(this).toggleClass('icon-bullet-closed'); $(this).toggleClass('icon-bullet-open'); return false;",
class: "icon icon-bullet-closed"
} %>
<%= i.name %>
</td>
<% @header.each do |q| %>
<td class="value"><%= values[q.id] || '-' %></td>
<% end %>
</tr>
<tr id="ingredient-desc-<%= i.id %>" class="ingredient <%= 'hidden' if i.hidden %>"
style="display:none">
<td></td>
<td colspan="<%= @header.length %>" class="description">
<%= @descriptions[i] %>
</td>
</tr>
<tr style="display:none"></tr>
<% end %>
</tbody>
</table>
<% else %>
<p class="nodata"><%= l(:label_no_data) %></p>
<% end %>