65 lines
2.5 KiB
Plaintext
65 lines
2.5 KiB
Plaintext
<tr id="meal-<%= m.id %>" class="primary meal project idnt idnt-1"
|
|
style="border: solid 2px <%= color %>;">
|
|
<td class="name unwrappable" style="background-color: <%= color %>;">
|
|
<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-links-<%= m.id %>" class="unwrappable"
|
|
style="text-align: left; border-left: none; width: 1%;">
|
|
<%= link_to l(:button_cancel), '', class: 'icon icon-cancel', style: 'display: none;',
|
|
onclick: "$(event.target).closest('tr').find('form').remove();
|
|
$('td[id=notes-#{m.id}]').contents().show();
|
|
$('td[id=notes-links-#{m.id}] a').toggle();
|
|
return false;" %>
|
|
|
|
<%= link_to l(:button_save), '', class: 'icon icon-save', style: 'display: none;',
|
|
onclick: "$(event.target).closest('tr').find('form').submit(); return false;" %>
|
|
|
|
<%= link_to l(:button_notes), edit_notes_meal_path(m), remote: true,
|
|
class: "icon icon-wiki-page" %>
|
|
</td>
|
|
|
|
<% if false %>
|
|
<td id="notes-<%= m.id %>" class="notes unwrappable" colspan="<%= @quantities.length + 1 %>"
|
|
style="text-align: left; border-left: none;">
|
|
<%= notes(m) %>
|
|
</td>
|
|
<% end %>
|
|
<td class="value ellipsible"></td>
|
|
<% @quantities.each do |q| %>
|
|
<td class="value ellipsible">
|
|
<%= format_value(@nutrient_summary[q][m], @nutrients[q][:precision]) %>
|
|
</td>
|
|
<% end %>
|
|
|
|
<td class="action unwrappable" style="width: 1%;"><%= 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 ellipsible" colspan="2"><%= i.food.name %></td>
|
|
<td class="value ellipsible">
|
|
<span><%= "%g" % i.amount %></span>
|
|
<%= "[#{i.food.ref_unit.shortname}]" unless i.food.ref_unit == @amount_mfu_unit %>
|
|
</td>
|
|
<% @quantities.each do |q| %>
|
|
<td class="value ellipsible">
|
|
<%= format_value(@nutrients[q][i], @nutrients[q][:precision],
|
|
@nutrients[q][:mfu_unit]) %>
|
|
</td>
|
|
<% end %>
|
|
<td class="action unwrappable" style="width: 1%; text-align: right;">
|
|
<%# Moved to helper to avoid spaces between buttons %>
|
|
<%= adjustment_buttons(i) %>
|
|
</td>
|
|
</tr>
|
|
<% end %>
|