1
0

Started Ingredient#create

This commit is contained in:
cryptogopher
2019-09-14 23:00:31 +02:00
parent faef248449
commit 0dcb13a065
6 changed files with 41 additions and 8 deletions

View File

@@ -8,11 +8,11 @@
</p>
<p><%= f.select :group, group_options, required: true %></p>
<% @ingredient.nutrients.each_with_index do |n, index| %>
<%= f.fields_for :nutrient, n, index: '' do |ff| %>
<%= f.fields_for 'nutrients_attributes', n, index: '' do |ff| %>
<p class="nutrient">
<%= ff.select :quantity_id, quantity_options,
label: (index > 0 ? '' : :field_nutrients) %>
<%= ff.number_field :amount, {size: 8, label: ''} %>
<%= ff.number_field :amount, {size: 8, min: 0, step: :any, label: ''} %>
<%= ff.select :unit_id, unit_options, label: '' %>
<%= ff.check_box :_destroy, {style: "display:none", label: ''} %>
<%= link_to t(".button_delete_nutrient"), '#',

View File

@@ -29,7 +29,6 @@
<tr>
<th><%= l(:field_name) %></th>
<th><%= l(:field_ref_amount) %></th>
<th><%= l(:field_ref_unit) %></th>
<th><%= l(:field_group) %></th>
<th><%= l(:field_source) %></th>
<th style="width:15%"><%= l(:field_action) %></th>
@@ -39,9 +38,9 @@
<% @ingredients.each do |i| %>
<tr id="ingredient-<%= i.id %>" class="ingredient <%= 'hidden' if i.hidden %>">
<td class="ingredientname"><%= i.name %></td>
<td class="ref_amount"><%= i.ref_amount %> [<%= i.ref_unit %>]</td>
<td class="ref_amount"><%= i.ref_amount %> [<%= i.ref_unit.shortname %>]</td>
<td class="group"><%= i.group %></td>
<td class="source"><%= i.source %></td>
<td class="source"><%#= i.source %></td>
<td><%= delete_link ingredient_path(i), data: {} %></td>
</tr>
<% end %>