parent_id -> parent_stable_id
This commit is contained in:
parent
1342356651
commit
5ebaf59fdb
9 changed files with 18 additions and 19 deletions
|
@ -33,7 +33,7 @@ class TypesDeChampEditor::AddChampButtonComponent < ApplicationComponent
|
|||
libelle: champ_libelle,
|
||||
type_champ: TypeDeChamp.type_champs.fetch(:text),
|
||||
private: annotations? ? true : nil,
|
||||
parent_id: @parent&.stable_id,
|
||||
parent_stable_id: @parent&.stable_id,
|
||||
after_stable_id: ''
|
||||
}.compact
|
||||
}
|
||||
|
|
|
@ -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_stable_id)
|
||||
.permit(:type_champ, :parent_stable_id, :private, :libelle, :after_stable_id)
|
||||
end
|
||||
|
||||
def type_de_champ_update_params
|
||||
|
|
|
@ -43,8 +43,7 @@ class ProcedureRevision < ApplicationRecord
|
|||
end
|
||||
|
||||
def add_type_de_champ(params)
|
||||
parent_stable_id = params.delete(:parent_id)
|
||||
after_stable_id = params.delete(:after_id)
|
||||
parent_stable_id = params.delete(:parent_stable_id)
|
||||
after_stable_id = params.delete(:after_stable_id)
|
||||
|
||||
coordinate = {}
|
||||
|
|
|
@ -78,7 +78,7 @@ describe Champ do
|
|||
procedure.active_revision.add_type_de_champ(
|
||||
libelle: 'header',
|
||||
type_champ: 'header_section',
|
||||
parent_id: procedure.types_de_champ.find(&:repetition?).stable_id
|
||||
parent_stable_id: procedure.types_de_champ.find(&:repetition?).stable_id
|
||||
)
|
||||
end
|
||||
end
|
||||
|
@ -524,7 +524,7 @@ describe Champ do
|
|||
let(:champ_text_attrs) { attributes_for(:champ_text, type_de_champ: tdc_text, row: 1) }
|
||||
|
||||
before do
|
||||
procedure.active_revision.add_type_de_champ(libelle: 'sub integer', type_champ: 'integer_number', parent_id: tdc_repetition.stable_id)
|
||||
procedure.active_revision.add_type_de_champ(libelle: 'sub integer', type_champ: 'integer_number', parent_stable_id: tdc_repetition.stable_id)
|
||||
end
|
||||
|
||||
context 'when creating the model directly' do
|
||||
|
|
|
@ -38,7 +38,7 @@ describe Champs::HeaderSectionChamp do
|
|||
revision.add_type_de_champ(
|
||||
libelle: tdc.libelle,
|
||||
type_champ: tdc.type_champ,
|
||||
parent_id: tdc_repetition.stable_id
|
||||
parent_stable_id: tdc_repetition.stable_id
|
||||
)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -163,8 +163,8 @@ describe TagsSubstitutionConcern, type: :model do
|
|||
let(:template) { '--Répétition--' }
|
||||
let(:repetition) do
|
||||
repetition_tdc = procedure.active_revision.add_type_de_champ(type_champ: 'repetition', libelle: 'Répétition')
|
||||
procedure.active_revision.add_type_de_champ(type_champ: 'text', libelle: 'Nom', parent_id: repetition_tdc.stable_id)
|
||||
procedure.active_revision.add_type_de_champ(type_champ: 'text', libelle: 'Prénom', parent_id: repetition_tdc.stable_id)
|
||||
procedure.active_revision.add_type_de_champ(type_champ: 'text', libelle: 'Nom', parent_stable_id: repetition_tdc.stable_id)
|
||||
procedure.active_revision.add_type_de_champ(type_champ: 'text', libelle: 'Prénom', parent_stable_id: repetition_tdc.stable_id)
|
||||
|
||||
repetition_tdc
|
||||
end
|
||||
|
|
|
@ -182,7 +182,7 @@ describe Dossier do
|
|||
procedure.draft_revision.add_type_de_champ({
|
||||
type_champ: TypeDeChamp.type_champs.fetch(:checkbox),
|
||||
libelle: "oui ou non",
|
||||
parent_id: repetition_type_de_champ.stable_id
|
||||
parent_stable_id: repetition_type_de_champ.stable_id
|
||||
})
|
||||
procedure.draft_revision.remove_type_de_champ(yes_no_type_de_champ.stable_id)
|
||||
|
||||
|
@ -365,8 +365,8 @@ describe Dossier do
|
|||
let!(:procedure) do
|
||||
create(:procedure).tap do |p|
|
||||
repetition = p.draft_revision.add_type_de_champ(type_champ: :repetition, libelle: 'p1')
|
||||
p.draft_revision.add_type_de_champ(type_champ: :text, libelle: 'c1', parent_id: repetition.stable_id)
|
||||
p.draft_revision.add_type_de_champ(type_champ: :text, libelle: 'c2', parent_id: repetition.stable_id)
|
||||
p.draft_revision.add_type_de_champ(type_champ: :text, libelle: 'c1', parent_stable_id: repetition.stable_id)
|
||||
p.draft_revision.add_type_de_champ(type_champ: :text, libelle: 'c2', parent_stable_id: repetition.stable_id)
|
||||
p.publish!
|
||||
end
|
||||
end
|
||||
|
@ -377,7 +377,7 @@ describe Dossier do
|
|||
|
||||
context 'when a child tdc is added in the middle' do
|
||||
before do
|
||||
added_tdc = procedure.draft_revision.add_type_de_champ(type_champ: :text, libelle: 'c3', parent_id: repetition_stable_id)
|
||||
added_tdc = procedure.draft_revision.add_type_de_champ(type_champ: :text, libelle: 'c3', parent_stable_id: repetition_stable_id)
|
||||
procedure.draft_revision.move_type_de_champ(added_tdc.stable_id, 1)
|
||||
end
|
||||
|
||||
|
|
|
@ -1477,7 +1477,7 @@ describe Dossier do
|
|||
draft = proc_test.draft_revision
|
||||
|
||||
tdc_repetition = draft.add_type_de_champ(type_champ: :repetition, libelle: "repetition")
|
||||
draft.add_type_de_champ(type_champ: :communes, libelle: "communes", parent_id: tdc_repetition.stable_id)
|
||||
draft.add_type_de_champ(type_champ: :communes, libelle: "communes", parent_stable_id: tdc_repetition.stable_id)
|
||||
|
||||
dossier_test = create(:dossier, procedure: proc_test)
|
||||
repetition = proc_test.types_de_champ_for_procedure_presentation.repetition.first
|
||||
|
|
|
@ -34,7 +34,7 @@ describe ProcedureRevision do
|
|||
end
|
||||
|
||||
context 'with a repetition child' do
|
||||
let(:tdc_params) { text_params.merge(parent_id: type_de_champ_repetition.stable_id) }
|
||||
let(:tdc_params) { text_params.merge(parent_stable_id: type_de_champ_repetition.stable_id) }
|
||||
|
||||
it do
|
||||
expect { subject }.to change { draft.reload.types_de_champ.count }.from(4).to(5)
|
||||
|
@ -93,7 +93,7 @@ describe ProcedureRevision do
|
|||
draft.add_type_de_champ({
|
||||
type_champ: TypeDeChamp.type_champs.fetch(:text),
|
||||
libelle: "second child",
|
||||
parent_id: type_de_champ_repetition.stable_id
|
||||
parent_stable_id: type_de_champ_repetition.stable_id
|
||||
})
|
||||
end
|
||||
|
||||
|
@ -101,7 +101,7 @@ describe ProcedureRevision do
|
|||
draft.add_type_de_champ({
|
||||
type_champ: TypeDeChamp.type_champs.fetch(:text),
|
||||
libelle: "last child",
|
||||
parent_id: type_de_champ_repetition.stable_id
|
||||
parent_stable_id: type_de_champ_repetition.stable_id
|
||||
})
|
||||
end
|
||||
|
||||
|
@ -159,7 +159,7 @@ describe ProcedureRevision do
|
|||
draft.add_type_de_champ({
|
||||
type_champ: TypeDeChamp.type_champs.fetch(:text),
|
||||
libelle: "second child",
|
||||
parent_id: type_de_champ_repetition.stable_id
|
||||
parent_stable_id: type_de_champ_repetition.stable_id
|
||||
})
|
||||
end
|
||||
|
||||
|
@ -167,7 +167,7 @@ describe ProcedureRevision do
|
|||
draft.add_type_de_champ({
|
||||
type_champ: TypeDeChamp.type_champs.fetch(:text),
|
||||
libelle: "last child",
|
||||
parent_id: type_de_champ_repetition.stable_id
|
||||
parent_stable_id: type_de_champ_repetition.stable_id
|
||||
})
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue