forked from fixin.me/fixin.me
@@ -43,6 +43,11 @@ class ApplicationController < ActionController::Base
|
||||
|
||||
private
|
||||
|
||||
def render_no_content(record)
|
||||
helpers.render_errors(record)
|
||||
render html: nil, layout: true
|
||||
end
|
||||
|
||||
def rescue_turbo(exception)
|
||||
raise unless request.format.to_sym == :turbo_stream
|
||||
|
||||
|
||||
@@ -43,7 +43,8 @@ class QuantitiesController < ApplicationController
|
||||
permitted = params.require(:quantity).permit(:parent_id)
|
||||
@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
|
||||
@quantity.depth = @ancestors.length
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
ondragstart: "dragStart(event)", ondragend: "dragEnd(event)",
|
||||
ondragover: "dragOver(event)", ondrop: "drop(event)",
|
||||
ondragenter: "dragEnter(event)", ondragleave: "dragLeave(event)",
|
||||
data: {drag_path: reparent_quantity_path(quantity),
|
||||
drop_id: dom_id(quantity.parent || quantity),
|
||||
data: {drag_path: reparent_quantity_path(quantity), drop_id: dom_id(quantity),
|
||||
drop_id_param: "quantity[parent_id]"} do %>
|
||||
|
||||
<td class="link" style="--depth:<%= quantity.depth %>">
|
||||
|
||||
Reference in New Issue
Block a user