Added Quantity nesting with awesome_nested_set
This commit is contained in:
@@ -1,13 +1,10 @@
|
||||
<%= error_messages_for @quantity %>
|
||||
|
||||
<div class="box tabular">
|
||||
<div class="splitcontent">
|
||||
<div class="splitcontentleft">
|
||||
<p><%= f.text_field :name, size: 50, required: true %></p>
|
||||
</div>
|
||||
<div class="splitcontentright">
|
||||
<p><%= f.select :domain, domain_options, required: true %></p>
|
||||
</div>
|
||||
</div>
|
||||
<p><%= f.select :domain, domain_options, required: true %></p>
|
||||
<p>
|
||||
<%= f.select :parent_id, parent_options, required: true, label: :field_parent_quantity %>
|
||||
</p>
|
||||
<p><%= f.text_field :name, size: 25, required: true %></p>
|
||||
<p><%= f.text_field :description, size: 200 %></p>
|
||||
</div>
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
</div>
|
||||
|
||||
<h2><%= t ".heading" %></h2>
|
||||
<% if @quantities.any? %>
|
||||
<% if Quantity.roots.any? %>
|
||||
<table class="list">
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -34,13 +34,16 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @quantities.each do |q| %>
|
||||
<tr id="quantity-<%= q.id %>" class="quantity">
|
||||
<td class="quantityname"><%= q.name %></td>
|
||||
<td class="domain"><%= q.domain %></td>
|
||||
<td class="description"><%= q.description %></td>
|
||||
<td><%= delete_link quantity_path(q), data: {} %></td>
|
||||
</tr>
|
||||
<% Quantity.roots.each do |r| %>
|
||||
<% Quantity.each_with_level(r.self_and_descendants) do |q, level| %>
|
||||
<tr id="quantity-<%= q.id %>"
|
||||
class="quantity <%= "project idnt idnt-#{level}" if level > 0 %>">
|
||||
<td class="name"><span><%= q.name %></span></td>
|
||||
<td class="domain"><%= q.domain %></td>
|
||||
<td class="description"><%= q.description %></td>
|
||||
<td><%= delete_link quantity_path(q), data: {} %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
Reference in New Issue
Block a user