From 04fe3ad2b672c6db27bbc281cad637ff1360da52 Mon Sep 17 00:00:00 2001 From: Martin Date: Wed, 20 Sep 2023 17:50:14 +0200 Subject: [PATCH] correctif(repetition.commune): ETQ usager, lorsque j'ai plus d'une repetition ayant un champ commune, les ids des options des input[type=radio] des communes partageant le meme code postal ne sont pas uniques, on boucle sur la 1ere repetition --- .../communes_component/communes_component.html.haml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/components/editable_champ/communes_component/communes_component.html.haml b/app/components/editable_champ/communes_component/communes_component.html.haml index c0ec73f3f..4999a9259 100644 --- a/app/components/editable_champ/communes_component/communes_component.html.haml +++ b/app/components/editable_champ/communes_component/communes_component.html.haml @@ -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"