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/foods/_index.html.erb
cryptogopher c24bdd6f45 Renamed: formula_q -> filter_q
Added Meal related associations to Project
2020-04-25 22:49:48 +02:00

46 lines
1.5 KiB
Plaintext

<%= render partial: 'foods/filters',
locals: {url: filter_project_foods_path(@project, view: :index)} %>
<% if @foods.any? { |f| f.persisted? } %>
<%= error_messages_for @filter_q.formula if @filter_q %>
<table class="list">
<thead>
<tr>
<th style="width:50%"><%= l(:field_name) %></th>
<th><%= l(:field_notes) %></th>
<th><%= l(:field_reference) %></th>
<th><%= l(:field_group) %></th>
<th><%= l(:field_source) %></th>
<th style="width:5%"><%= l(:field_action) %></th>
</tr>
</thead>
<tbody>
<% @foods.each do |f| %>
<% next if f.new_record? %>
<tr id="food-<%= f.id %>"
class="food primary<%= ' hidden' if f.hidden %>">
<td class="name ellipsible">
<%= link_to '', toggle_food_path(f), {
remote: true,
method: :post,
class: "icon icon-eye"
} %>
<%= f.name %>
</td>
<td class="notes ellipsible"><%= f.notes %></td>
<td class="reference value"><%= f.ref_amount %> [<%= f.ref_unit.shortname %>]</td>
<td class="group"><%= f.group %></td>
<td class="source">
<%= f.source.name if f.source.present? %>
<%= ", #{f.source_ident}" if f.source_ident.present? %>
</td>
<td class="action unwrappable"><%= action_links(f, :index) %></td>
</tr>
<% end %>
</tbody>
</table>
<% else %>
<p class="nodata"><%= l(:label_no_data) %></p>
<% end %>