forked from fixin.me/fixin.me
parent
8524beefdc
commit
201359de3e
@ -43,6 +43,11 @@ class ApplicationController < ActionController::Base
|
|||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
def render_no_content(record)
|
||||||
|
helpers.render_errors(record)
|
||||||
|
render html: nil, layout: true
|
||||||
|
end
|
||||||
|
|
||||||
def rescue_turbo(exception)
|
def rescue_turbo(exception)
|
||||||
raise unless request.format.to_sym == :turbo_stream
|
raise unless request.format.to_sym == :turbo_stream
|
||||||
|
|
||||||
|
@ -43,7 +43,8 @@ class QuantitiesController < ApplicationController
|
|||||||
permitted = params.require(:quantity).permit(:parent_id)
|
permitted = params.require(:quantity).permit(:parent_id)
|
||||||
@previous_ancestors = @quantity.ancestors
|
@previous_ancestors = @quantity.ancestors
|
||||||
|
|
||||||
@quantity.update!(permitted)
|
# Until UI blocks all disallowed reparents, render error messages if present
|
||||||
|
render_no_content(@quantity) unless @quantity.update(permitted)
|
||||||
|
|
||||||
@ancestors = @quantity.ancestors
|
@ancestors = @quantity.ancestors
|
||||||
@quantity.depth = @ancestors.length
|
@quantity.depth = @ancestors.length
|
||||||
|
@ -2,8 +2,7 @@
|
|||||||
ondragstart: "dragStart(event)", ondragend: "dragEnd(event)",
|
ondragstart: "dragStart(event)", ondragend: "dragEnd(event)",
|
||||||
ondragover: "dragOver(event)", ondrop: "drop(event)",
|
ondragover: "dragOver(event)", ondrop: "drop(event)",
|
||||||
ondragenter: "dragEnter(event)", ondragleave: "dragLeave(event)",
|
ondragenter: "dragEnter(event)", ondragleave: "dragLeave(event)",
|
||||||
data: {drag_path: reparent_quantity_path(quantity),
|
data: {drag_path: reparent_quantity_path(quantity), drop_id: dom_id(quantity),
|
||||||
drop_id: dom_id(quantity.parent || quantity),
|
|
||||||
drop_id_param: "quantity[parent_id]"} do %>
|
drop_id_param: "quantity[parent_id]"} do %>
|
||||||
|
|
||||||
<td class="link" style="--depth:<%= quantity.depth %>">
|
<td class="link" style="--depth:<%= quantity.depth %>">
|
||||||
|
@ -31,8 +31,10 @@ en:
|
|||||||
taken: has to be unique
|
taken: has to be unique
|
||||||
quantity:
|
quantity:
|
||||||
attributes:
|
attributes:
|
||||||
|
name:
|
||||||
|
taken: has to be unique among siblings
|
||||||
parent:
|
parent:
|
||||||
descendant_reference: of the quantity cannot be its descendant
|
descendant_reference: cannot be changed to any of descendants
|
||||||
self_reference: of the quantitiy cannot be the quantity itself
|
self_reference: of the quantitiy cannot be the quantity itself
|
||||||
user_mismatch: has to belong to the same user as quantity
|
user_mismatch: has to belong to the same user as quantity
|
||||||
actioncontroller:
|
actioncontroller:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user