Merge pull request #9501 from mfo/US/fix-commune-in-repetition

correctif(repetition.commune): ETQ usager, lorsque j'ai plus d'une repetition ayant un champ commune séléctionnée avec le meme code postal, les ids des options des input[type=radio] communes partageant le meme code postal ne sont pas uniques, on boucle donc sur la 1ere repetition quand on veut en selectionner un 🤯
This commit is contained in:
mfo 2023-09-21 06:27:21 +00:00 committed by GitHub
commit 6abd0f8db0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -16,8 +16,8 @@
- commune_options.each.with_index do |(option, value), index|
.fr-fieldset__element
.fr-radio-group
= @form.radio_button :value, value, checked: @champ.selected == value, id: index == 0 ? @champ.input_id : "radio-#{index}-#{value.parameterize}"
= @form.label :value, option, for: index == 0 ? @champ.input_id : "radio-#{index}-#{value.parameterize}", class: 'fr-label'
= @form.radio_button :value, value, checked: @champ.selected == value, id: "#{code_postal_input_id}-#{value.parameterize}"
= @form.label :value, option, for: "#{code_postal_input_id}-#{value.parameterize}", class: 'fr-label'
- else
= @form.label :value, t('.commune').html_safe, for: @champ.input_id, class: 'fr-label'
= @form.select :value, commune_options, commune_select_options, required: @champ.required?, id: @champ.input_id, aria: { describedby: @champ.describedby_id }, class: "width-33-desktop width-100-mobile fr-select"