1
0

Replaced Quantity 'primary' attr with ColumnView model

This commit is contained in:
cryptogopher
2019-12-14 23:56:36 +01:00
parent ccf26d1830
commit 0c0ca1d286
19 changed files with 91 additions and 65 deletions

View File

@@ -1,15 +1,15 @@
<fieldset id="options" class="collapsible">
<legend onclick="toggleFieldset(this);"><%= l(:label_options) %></legend>
<div>
<%= form_tag toggle_nutrient_column_project_ingredients_path(@project),
id: 'nutrient-column-add-form', name: 'nutrient-column-add-form',
<%= form_tag toggle_column_project_ingredients_path(@project),
id: 'toggle-column-form', name: 'toggle-column-form',
method: :post, remote: true do %>
<table>
<tr>
<td style="width:100%"></td>
<td>
<%= select_tag 'id', nutrient_column_options %>
<%= select_tag 'id', toggle_column_options %>
</td>
<td>
<%= submit_tag l(:button_add) %>
@@ -27,7 +27,7 @@
<% @quantities.each do |q| %>
<td class="action" style="width:<%= 100/total_width %>%">
<%= link_to l(:button_hide),
toggle_nutrient_column_project_ingredients_path(@project, id: q.id),
toggle_column_project_ingredients_path(@project, quantity_id: q.id),
{class: "icon icon-close", method: :post, remote: true} %>
</td>
<% end %>

View File

@@ -1,15 +1,15 @@
<fieldset id="options" class="collapsible">
<legend onclick="toggleFieldset(this);"><%= l(:label_options) %></legend>
<div>
<%= form_tag toggle_quantity_project_measurements_path(@project),
id: 'quantity-toggle-form', name: 'quantity-toggle-form',
<%= form_tag toggle_column_measurement_path(@measurement),
id: 'toggle-column-form', name: 'toggle-column-form',
method: :post, remote: true do %>
<table>
<tr>
<td style="width:100%"></td>
<td>
<%= select_tag 'id', quantity_toggle_options %>
<%= select_tag 'id', toggle_column_options %>
</td>
<td>
<%= submit_tag l(:button_add) %>
@@ -27,7 +27,7 @@
<% @quantities.each do |q| %>
<td class="action" style="width:<%= 100/total_width %>%">
<%= link_to l(:button_hide),
toggle_quantity_project_measurements_path(@project, id: q.id),
toggle_column_measurement_path(@measurement, quantity_id: q.id),
{class: "icon icon-close", method: :post, remote: true} %>
</td>
<% end %>

View File

@@ -13,5 +13,4 @@
<p><%= f.text_field :description, style: "width: 100%;" %></p>
<p><%= f.text_field :formula, placeholder: t('.formula_placeholder'),
style: "width: 100%;" %></p>
<p><%= f.check_box :primary %></p>
</div>

View File

@@ -19,18 +19,9 @@
next if q.new_record?
quantity_class = "quantity"
quantity_class += " project idnt idnt-#{level+1}"
quantity_class += " primary" if q.primary
%>
<tr id="quantity-<%= q.id %>" class="<%= quantity_class %>">
<td class="name">
<%= link_to '', toggle_quantity_path(q), {
remote: true,
method: :post,
class: "icon #{q.primary ? "icon-fav" : "icon-fav-off"}"
}
%>
<%= q.name %>
</td>
<td class="name"><%= q.name %></td>
<td class="order">
<% [:up, :down, :left, :right].each do |direction| %>
<%=