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/meals/_show.html.erb
2020-04-24 00:54:32 +02:00

39 lines
1.6 KiB
Plaintext

<tr id="meal-<%= m.id %>" class="primary meal project idnt idnt-1 odd">
<td class="name unwrappable" style="width: 5%; border-right: none;">
<b><%= "#{t '.label_meal'} ##{index+1}" %></b>
<% if m.eaten_at %>
<%= " at #{m.eaten_at.strftime('%R')}" %>
<%= link_to '', toggle_eaten_meal_path(m),
{remote: true, method: :post, class: "icon icon-close"} %>
<% else %>
<%= link_to l(:button_eat), toggle_eaten_meal_path(m),
{remote: true, method: :post, class: "icon icon-time"} %>
<% end %>
</td>
<td id="notes-<%= m.id %>" class="notes" style="text-align: left; border-left: none;"
colspan="4"><%= display_notes(m) %></td>
<td class="action" style="width: 5%;"><%= meal_links(m) %></td>
</tr>
<% m.ingredients.each do |i| %>
<tr id="ingredient-<%= i.id %>" class="ingredient project idnt idnt-2 buttonable">
<td class="name unwrappable" style="width: 5%;"><%= i.food.name %></td>
<td class="unwrappable" style="width: 1%;">
<% {'- -' => -10, '-' => -1, nil => 0, '+' => 1, '++' => 10}.map do |text, value| %>
<% if text %>
<%= link_to text, adjust_ingredient_path(i, adjustment: value),
{remote: true, method: :post, class: "button #{value>0 ? 'green' : 'red'}"} %>
<% else %>
</td>
<td class="amount unwrappable" style="width: 1%; text-align: right;">
<span><%= i.amount %></span>[<%= i.food.ref_unit.shortname %>]
</td>
<td class="unwrappable" style="width: 1%;">
<% end %>
<% end %>
</td>
<td colspan="2"></td>
</tr>
<% end %>
</tr>