44 lines
1.5 KiB
Plaintext
44 lines
1.5 KiB
Plaintext
<% if @meals.any? { |m| m.persisted? } %>
|
|
<table id="meals" class="odd-even">
|
|
<tbody>
|
|
<% @meals.group_by { |m| m.eaten_at.date if m.eaten_at }.each do |d, meals| %>
|
|
<% meals.each_with_index do |m, index| %>
|
|
<% next if m.new_record? %>
|
|
<tr id="meal-<%= m.id %>" class="primary meal">
|
|
<td class="name" colspan="2">
|
|
<h4>
|
|
<%= "#{t '.label_meal'}" %><%= index ? " ##{index+1}" : " (new)" %>
|
|
<%= ", #{m.eaten_at.time}" if m.eaten_at %>
|
|
</h4>
|
|
</td>
|
|
<td class="action unwrappable" style="width:5%"><%= meal_links(m) %></td>
|
|
</tr>
|
|
<% m.ingredients.each do |i| %>
|
|
<tr id="ingredient-<%= i.id %>" class="ingredient">
|
|
<td class="name" style="width: 100%;">
|
|
<p>
|
|
<%= i.food.name %>
|
|
</p>
|
|
</td>
|
|
<td>
|
|
<p style='white-space: nowrap;'>
|
|
<%= adjust_ingredient_link(i, -5) %>
|
|
<%= adjust_ingredient_link(i, -1) %>
|
|
<%= i.amount %>
|
|
<%= adjust_ingredient_link(i, 1) %>
|
|
<%= adjust_ingredient_link(i, 5) %>
|
|
</p>
|
|
</td>
|
|
<td class="action unwrappable" style="width:5%">
|
|
</td>
|
|
</tr>
|
|
<% end %>
|
|
</tr>
|
|
<% end %>
|
|
<% end %>
|
|
</tbody>
|
|
</table>
|
|
<% else %>
|
|
<p class="nodata"><%= l(:label_no_data) %></p>
|
|
<% end %>
|