1
0

Displaying amount column in same format as quantities

This commit is contained in:
cryptogopher
2020-04-29 23:12:59 +02:00
parent da11c0f626
commit e74c707729
3 changed files with 11 additions and 4 deletions

View File

@@ -13,8 +13,8 @@
<td class="date" colspan="2" style="width:<%= 3 * 100/total_width %>%" rowspan="2">
<h3><%= date == Date.current ? 'Today' : date.strftime('%F') %></h3>
</td>
<td style="width:<%= 100/total_width %>%; text-align: left;" rowspan="2">
<b><%= l(:field_amount) %></b>
<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 %>%;"
@@ -25,10 +25,13 @@
<td style="width:<%= 100/total_width %>%" rowspan="2"></td>
</tr>
<tr>
<td class="quantityhead" style="width:<%= 100/total_width %>%;">
<%= "[#{@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 ? mfu_unit.shortname : '-'}]" %>
</td>
<% end %>
</tr>

View File

@@ -37,7 +37,8 @@
<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><%= i.amount %></span>[<%= i.food.ref_unit.shortname %>]
<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">