IngredientsController#index WIP
This commit is contained in:
@@ -13,8 +13,8 @@
|
||||
<%= label_tag :food_name do %>
|
||||
<%= index > 0 ? '' : t(:field_ingredients) %><span class="required"> *</span>
|
||||
<% end %>
|
||||
<%= text_field_tag :food_name, nil, {class: "autocomplete autocomplete-label",
|
||||
style: "width: 80%;"} %>
|
||||
<%= text_field_tag :food_name, (i.food.name if i.food),
|
||||
{class: "autocomplete autocomplete-label", style: "width: 80%;"} %>
|
||||
<%= ff.number_field :amount, {style: "width: 8%", step: :any, label: ''} %>
|
||||
<%= i.food.ref_unit.shortname if i.food %>
|
||||
<%= ff.hidden_field :_destroy %>
|
||||
|
||||
@@ -3,14 +3,36 @@
|
||||
<tbody>
|
||||
<% @meals.group_by { |m| m.eaten_at.date if m.eaten_at }.each do |d, meals| %>
|
||||
<% meals.each_with_index do |m, index| %>
|
||||
<tr id="meal-<%= m.new_record? ? 'new' : m.id %>" class="primary meal">
|
||||
<td class="name">
|
||||
<% next if m.new_record? %>
|
||||
<tr id="meal-<%= m.id %>" class="primary meal">
|
||||
<td class="name" colspan="2">
|
||||
<h4>
|
||||
<%= "#{t '.label_meal'}" %><%= index ? " ##{index+1}" : " (new)" %>
|
||||
<%= ", #{m.eaten_at.time}" if m.eaten_at %>
|
||||
</h4>
|
||||
</td>
|
||||
<td class="action unwrappable" style="width:5%"><%= action_links(m) %></td>
|
||||
<td class="action unwrappable" style="width:5%"><%= meal_links(m) %></td>
|
||||
</tr>
|
||||
<% m.ingredients.each do |i| %>
|
||||
<tr id="ingredient-<%= i.id %>" class="ingredient">
|
||||
<td class="name" style="width: 100%;">
|
||||
<p>
|
||||
<%= i.food.name %>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p style='white-space: nowrap;'>
|
||||
<%= adjust_ingredient_link(i, -5) %>
|
||||
<%= adjust_ingredient_link(i, -1) %>
|
||||
<%= i.amount %>
|
||||
<%= adjust_ingredient_link(i, 1) %>
|
||||
<%= adjust_ingredient_link(i, 5) %>
|
||||
</p>
|
||||
</td>
|
||||
<td class="action unwrappable" style="width:5%">
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
Reference in New Issue
Block a user