diff --git a/app/components/types_de_champ_editor/add_champ_button_component.rb b/app/components/types_de_champ_editor/add_champ_button_component.rb index b162ecbdd..c9221b4a7 100644 --- a/app/components/types_de_champ_editor/add_champ_button_component.rb +++ b/app/components/types_de_champ_editor/add_champ_button_component.rb @@ -34,7 +34,7 @@ class TypesDeChampEditor::AddChampButtonComponent < ApplicationComponent type_champ: TypeDeChamp.type_champs.fetch(:text), private: annotations? ? true : nil, parent_id: @parent&.stable_id, - after_id: '' + after_stable_id: '' }.compact } } diff --git a/app/controllers/administrateurs/types_de_champ_controller.rb b/app/controllers/administrateurs/types_de_champ_controller.rb index 1b982c871..ffbe6ac18 100644 --- a/app/controllers/administrateurs/types_de_champ_controller.rb +++ b/app/controllers/administrateurs/types_de_champ_controller.rb @@ -55,7 +55,7 @@ module Administrateurs def type_de_champ_create_params params .required(:type_de_champ) - .permit(:type_champ, :parent_id, :private, :libelle, :after_id) + .permit(:type_champ, :parent_id, :private, :libelle, :after_stable_id) end def type_de_champ_update_params diff --git a/app/javascript/controllers/type_de_champ_editor_controller.ts b/app/javascript/controllers/type_de_champ_editor_controller.ts index e9e472533..84e5144bd 100644 --- a/app/javascript/controllers/type_de_champ_editor_controller.ts +++ b/app/javascript/controllers/type_de_champ_editor_controller.ts @@ -139,7 +139,7 @@ export class TypeDeChampEditorController extends ApplicationController { ? '.add-to-block' : '.add-to-root'; const input = parent.querySelector( - `${selector} ${AFTER_ID_INPUT_SELECTOR}` + `${selector} ${AFTER_STABLE_ID_INPUT_SELECTOR}` ); if (input) { input.value = this.typeDeChampIdValue; @@ -148,7 +148,8 @@ export class TypeDeChampEditorController extends ApplicationController { } } -const AFTER_ID_INPUT_SELECTOR = 'input[name="type_de_champ[after_id]"]'; +const AFTER_STABLE_ID_INPUT_SELECTOR = + 'input[name="type_de_champ[after_stable_id]"]'; function createForm(action: string, method: string) { const form = document.createElement('form'); diff --git a/app/models/procedure_revision.rb b/app/models/procedure_revision.rb index 58a7c4cc8..ae44b3360 100644 --- a/app/models/procedure_revision.rb +++ b/app/models/procedure_revision.rb @@ -45,6 +45,7 @@ class ProcedureRevision < ApplicationRecord def add_type_de_champ(params) parent_stable_id = params.delete(:parent_id) after_stable_id = params.delete(:after_id) + after_stable_id = params.delete(:after_stable_id) coordinate = {}