forked from fixin.me/fixin.me
Allow to drag all Quantities
This commit is contained in:
parent
644d1f4b9a
commit
8524beefdc
@ -62,7 +62,7 @@ class Quantity < ApplicationRecord
|
|||||||
name
|
name
|
||||||
end
|
end
|
||||||
|
|
||||||
def movable?
|
def destroyable?
|
||||||
subquantities.empty?
|
subquantities.empty?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -17,13 +17,9 @@
|
|||||||
<%= image_link_to t('.new_subquantity'), 'plus-outline', new_quantity_path(quantity),
|
<%= image_link_to t('.new_subquantity'), 'plus-outline', new_quantity_path(quantity),
|
||||||
id: dom_id(quantity, :new, :link), onclick: 'this.blur();', data: {turbo_stream: true} %>
|
id: dom_id(quantity, :new, :link), onclick: 'this.blur();', data: {turbo_stream: true} %>
|
||||||
|
|
||||||
<%= image_button_to_if quantity.movable?, t('.destroy'), 'delete-outline',
|
<%= image_button_to_if quantity.destroyable?, t('.destroy'), 'delete-outline',
|
||||||
quantity_path(quantity), method: :delete %>
|
quantity_path(quantity), method: :delete %>
|
||||||
</td>
|
</td>
|
||||||
<% if quantity.movable? %>
|
<td class="handle" draggable="true">⠿</td>
|
||||||
<td class="handle" draggable="true">⠿</td>
|
|
||||||
<% else %>
|
|
||||||
<td></td>
|
|
||||||
<% end %>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user