1
0

Add Targets #show

Change css classes from subject-oriented to property-oriented
This commit is contained in:
cryptogopher
2021-05-05 12:42:30 +02:00
parent 8cac724694
commit e301665b6a
22 changed files with 132 additions and 130 deletions

View File

@@ -18,9 +18,8 @@
<tbody>
<% @foods.each do |f| %>
<% next if f.new_record? %>
<tr id="food-<%= f.id %>"
class="food primary<%= ' hidden' if f.hidden %>">
<td class="name ellipsible">
<tr id="food-<%= f.id %>" class="food primary<%= ' dimmed' if f.hidden %>">
<td class="topleft ellipsible">
<%= link_to '', toggle_food_path(f), {
remote: true,
method: :post,
@@ -29,13 +28,13 @@
<%= f.name %>
</td>
<td class="notes ellipsible"><%= f.notes %></td>
<td class="reference value"><%= f.ref_amount %> [<%= f.ref_unit.shortname %>]</td>
<td class="reference right"><%= f.ref_amount %> [<%= f.ref_unit.shortname %>]</td>
<td class="group"><%= f.group %></td>
<td class="source">
<%= f.source.name if f.source.present? %>
<%= ", #{f.source_ident}" if f.source_ident.present? %>
</td>
<td class="action unwrappable"><%= action_links(f, :index) %></td>
<td class="right shrunk unwrappable"><%= action_links(f, :index) %></td>
</tr>
<% end %>
</tbody>

View File

@@ -34,19 +34,19 @@
<tbody>
<% extra_quantities = @foods.values.first.keys - @quantities %>
<% @foods.each do |food, nutrients| %>
<% row_class = "food#{' hidden' if food.hidden} #{cycle('odd', 'even')}" %>
<% row_class = "food#{' dimmed' if food.hidden} #{cycle('odd', 'even')}" %>
<tr id="food-<%= food.id %>" class="primary <%= row_class %>">
<td class="name ellipsible" style="cursor: pointer;"
<td class="topleft ellipsible" style="cursor: pointer;"
onclick="$(this).closest('tr').toggle(); $(this).closest('tr').nextUntil('tr.primary', '.food').toggle(); return false;">
<span class="icon icon-bullet-closed"><%= food.name %></span>
</td>
<% @quantities.each do |q| %>
<td class="primary value ellipsible">
<td class="primary right ellipsible">
<%= format_value(nutrients[q], @food_summary[:precision][q],
@food_summary[:mfu_unit][q]) %>
</td>
<% end %>
<td class="action unwrappable"><%= action_links(food, :nutrients) %></td>
<td class="right shrunk unwrappable"><%= action_links(food, :nutrients) %></td>
</tr>
<tr class="<%= row_class %>" style="display:none">
@@ -55,17 +55,17 @@
else
rows = 1
end %>
<td rowspan="<%= rows %>" class="name ellipsible" style="cursor: pointer;"
<td rowspan="<%= rows %>" class="topleft ellipsible" style="cursor: pointer;"
onclick="$(this).closest('tr').prev('tr.primary').toggle(); $(this).closest('tr').prev('tr.primary').nextUntil('tr.primary', '.food').toggle(); return false;">
<span class="icon icon-bullet-open"><%= food.name %></span>
</td>
<% @quantities.each do |q| %>
<td class="primary quantity ellipsible">
<td class="primary topleft ellipsible">
<%= q.name %>
<p class="value"><%= format_value(nutrients[q]) %></p>
<p class="right"><%= format_value(nutrients[q]) %></p>
</td>
<% end %>
<td rowspan="<%= rows %>" class="action unwrappable">
<td rowspan="<%= rows %>" class="right shrunk unwrappable">
<%= action_links(food, :nutrients) %>
</td>
</tr>
@@ -74,9 +74,9 @@
<% extra_quantities.each_slice(@quantities.length) do |eqs| %>
<tr class="extra <%= row_class %>" style="display:none">
<% eqs.each do |q| %>
<td class="extra quantity ellipsible">
<td class="extra topleft ellipsible">
<%= q.name if nutrients[q] %>
<p class="value"><%= format_value(nutrients[q]) %></p>
<p class="right"><%= format_value(nutrients[q]) %></p>
</td>
<% end %>
<% if @quantities.length > eqs.length %>