1
0

Displaying date summary

This commit is contained in:
cryptogopher 2020-05-01 18:45:22 +02:00
parent f6a7f0219e
commit dafebdc529
2 changed files with 18 additions and 11 deletions

View File

@ -10,14 +10,12 @@
<% total_width = 4 + @quantities.length %>
<% @meals_by_date.reverse_each do |date, meals| %>
<tr id="date-<%= date.strftime('%Y%m%d') %>" class="date">
<td class="date" colspan="2" style="width:<%= 3 * 100/total_width %>%" rowspan="2">
<h3><%= date == Date.current ? 'Today' : date.strftime('%F') %></h3>
</td>
<td colspan="2" rowspan="2" style="width:<%= 3 * 100/total_width %>%"></td>
<td class="quantityhead" style="width:<%= 100/total_width %>%;">
<%= l(:field_amount) %>
</td>
<% @quantities.each do |q| %>
<td class="quantityhead closable" style="width: <%= 100/total_width %>%;"
<td class="quantityhead" style="width: <%= 100/total_width %>%;"
title="<%= q.description %>">
<%= q.name %>
</td>
@ -26,15 +24,24 @@
</tr>
<tr>
<td class="quantityhead" style="width:<%= 100/total_width %>%;">
<%= "[#{@amount_mfu_unit.shortname}]" %>
</td>
<td class="quantityhead"><%= "[#{@amount_mfu_unit.shortname}]" %></td>
<% @quantities.each do |q| %>
<td class="quantityhead" style="width: <%= 100/total_width %>%;">
<% mfu_unit = @nutrients[q][:mfu_unit] %>
<%= "[#{mfu_unit ? mfu_unit.shortname : '-'}]" %>
<% mfu_unit = @nutrients[q][:mfu_unit] %>
<td class="quantityhead"><%= "[#{mfu_unit ? mfu_unit.shortname : '-'}]" %></td>
<% end %>
</tr>
<tr>
<td class="date" colspan="2">
<h3><%= date == Date.current ? 'Today' : date.strftime('%F') %></h3>
</td>
<td class="value ellipsible"></td>
<% @quantities.each do |q| %>
<td class="value ellipsible">
<%= format_value(@nutrient_summary[q][date], @nutrients[q][:precision]) %>
</td>
<% end %>
<td></td>
</tr>
<% meals.each_with_index do |m, index| %>

View File

@ -32,7 +32,7 @@
<%= notes(m) %>
</td>
<% end %>
<td class="value ellipsible"></td>
<td class="value ellipsible"></td>
<% @quantities.each do |q| %>
<td class="value ellipsible">
<%= format_value(@nutrient_summary[q][m], @nutrients[q][:precision]) %>