Added Ingredient comment attribute
Minor view updates
This commit is contained in:
@@ -88,6 +88,7 @@ class IngredientsController < ApplicationController
|
||||
|
||||
i_params = {
|
||||
name: r.delete('Name'),
|
||||
comment: r.delete('Comment'),
|
||||
ref_amount: 100.0,
|
||||
ref_unit: units['g'],
|
||||
group: r.delete('Group') || :other,
|
||||
@@ -176,6 +177,7 @@ class IngredientsController < ApplicationController
|
||||
def ingredient_params
|
||||
params.require(:ingredient).permit(
|
||||
:name,
|
||||
:comment,
|
||||
:ref_amount,
|
||||
:ref_unit_id,
|
||||
:group,
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
|
||||
<div class="box tabular">
|
||||
<p><%= f.text_field :name, size: 40, required: true %></p>
|
||||
<p><%= f.text_area :comment, cols: 40, rows: 3, required: false,
|
||||
style: "width: 100%;" %></p>
|
||||
<p>
|
||||
<%= f.number_field :ref_amount, size: 8, required: true, min: 0,
|
||||
label: :field_reference %>
|
||||
|
||||
@@ -5,18 +5,19 @@
|
||||
<table class="list">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><%= l(:field_name) %></th>
|
||||
<th style="width:50%"><%= l(:field_name) %></th>
|
||||
<th><%= l(:field_comment) %></th>
|
||||
<th><%= l(:field_reference) %></th>
|
||||
<th><%= l(:field_group) %></th>
|
||||
<th><%= l(:field_source) %></th>
|
||||
<th style="width:10%"><%= l(:field_action) %></th>
|
||||
<th style="width:5%"><%= l(:field_action) %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @ingredients.each do |i| %>
|
||||
<% next if i.new_record? %>
|
||||
<tr id="ingredient-<%= i.id %>" class="ingredient <%= 'hidden' if i.hidden %>">
|
||||
<td class="name">
|
||||
<td class="name ellipsible">
|
||||
<%= link_to '', toggle_ingredient_path(i), {
|
||||
remote: true,
|
||||
method: :post,
|
||||
@@ -24,13 +25,14 @@
|
||||
} %>
|
||||
<%= i.name %>
|
||||
</td>
|
||||
<td class="comment ellipsible"><%= i.comment %></td>
|
||||
<td class="reference value"><%= i.ref_amount %> [<%= i.ref_unit.shortname %>]</td>
|
||||
<td class="group"><%= i.group %></td>
|
||||
<td class="source">
|
||||
<%= i.source.name if i.source.present? %>
|
||||
<%= ", #{i.source_ident}" if i.source_ident.present? %>
|
||||
</td>
|
||||
<td class="action">
|
||||
<td class="action unwrappable">
|
||||
<%= delete_link ingredient_path(i), {remote: true, data: {}} %>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -18,7 +18,8 @@
|
||||
<% @nutrients.each do |i, values| %>
|
||||
<% row_class = "ingredient#{' hidden' if i.hidden} #{cycle('odd', 'even')}" %>
|
||||
<tr id="ingredient-<%= i.id %>" class="primary <%= row_class %>">
|
||||
<td class="name" style="cursor: pointer;" onclick="$(this).closest('tr').toggle(); $(this).closest('tr').nextUntil('tr.primary', 'tr').toggle(); return false;">
|
||||
<td class="name ellipsible" style="cursor: pointer;"
|
||||
onclick="$(this).closest('tr').toggle(); $(this).closest('tr').nextUntil('tr.primary', 'tr').toggle(); return false;">
|
||||
<span class="icon icon-bullet-closed"><%= i.name %></span>
|
||||
</td>
|
||||
<% values.each do |*, value| %>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<th style="width:5%"><%= l(:field_taken_at_date) %></th>
|
||||
<th><%= l(:field_name) %></th>
|
||||
<th><%= l(:field_source) %></th>
|
||||
<th style="width:10%"><%= l(:field_action) %></th>
|
||||
<th style="width:5%"><%= l(:field_action) %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<th><%= l(:field_domain) %></th>
|
||||
<th><%= l(:field_description) %></th>
|
||||
<th><%= l(:field_formula) %></th>
|
||||
<th style="width:10%"><%= l(:field_action) %></th>
|
||||
<th style="width:5%"><%= l(:field_action) %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
<tr>
|
||||
<th><%= l(:field_name) %></th>
|
||||
<th><%= l(:field_description) %></th>
|
||||
<th style="width:10%"><%= l(:field_action) %></th>
|
||||
<th style="width:5%"><%= l(:field_action) %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
<tr>
|
||||
<th><%= l(:field_shortname) %></th>
|
||||
<th><%= l(:field_name) %></th>
|
||||
<th style="width:10%"><%= l(:field_action) %></th>
|
||||
<th style="width:5%"><%= l(:field_action) %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
Reference in New Issue
Block a user