refactor(dossier): use champ id as champ attributes key

This commit is contained in:
Paul Chavard 2022-04-28 15:03:07 +02:00
parent 1126099e0b
commit b94bc8fd8a
4 changed files with 34 additions and 10 deletions

View file

@ -35,10 +35,9 @@
dossier.procedure.groupe_instructeurs.order(:label).map { |gi| [gi.label, gi.id] },
{ include_blank: dossier.brouillon? }
= f.fields_for :champs, dossier.champs do |champ_form|
- champ = champ_form.object
= render partial: "shared/dossiers/editable_champs/editable_champ",
locals: { champ: champ, form: champ_form }
- dossier.champs.each do |champ|
= fields_for champ.input_name, champ do |form|
= render partial: "shared/dossiers/editable_champs/editable_champ", locals: { form: form, champ: champ }
- if !dossier.for_procedure_preview?
.dossier-edit-sticky-footer

View file

@ -8,5 +8,6 @@
= render partial: 'shared/dossiers/editable_champs/champ_label', locals: { form: form, champ: champ, seen_at: defined?(seen_at) ? seen_at : nil }
- if champ.type_champ == "titre_identite"
%p.notice Carte nationale didentité (uniquement le recto), passeport, titre de séjour ou autre justificatif didentité. Formats acceptés : jpg/png
= render partial: "shared/dossiers/editable_champs/#{champ.type_champ}",
locals: { champ: champ, form: form }
= form.hidden_field :id, value: champ.id
= render partial: "shared/dossiers/editable_champs/#{champ.type_champ}", locals: { form: form, champ: champ }