From 0519dece966222eae5a8c126f93fd14c91daa7f0 Mon Sep 17 00:00:00 2001 From: Martin Date: Tue, 5 Mar 2024 17:21:29 +0100 Subject: [PATCH] fix(Champs::Civilite): fix dsfr missing red feedback, add green feedback --- .../editable_champ/civilite_component.rb | 3 +++ .../civilite_component.html.haml | 24 +++++++++---------- app/models/champs/civilite_champ.rb | 4 ++++ 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/app/components/editable_champ/civilite_component.rb b/app/components/editable_champ/civilite_component.rb index 7c2434207..6f3b61705 100644 --- a/app/components/editable_champ/civilite_component.rb +++ b/app/components/editable_champ/civilite_component.rb @@ -1,2 +1,5 @@ class EditableChamp::CiviliteComponent < EditableChamp::EditableChampBaseComponent + def dsfr_champ_container + :fieldset + end end diff --git a/app/components/editable_champ/civilite_component/civilite_component.html.haml b/app/components/editable_champ/civilite_component/civilite_component.html.haml index b656a0359..887a844c2 100644 --- a/app/components/editable_champ/civilite_component/civilite_component.html.haml +++ b/app/components/editable_champ/civilite_component/civilite_component.html.haml @@ -1,13 +1,11 @@ -%fieldset.fr-fieldset - %legend.fr-fieldset__legend--regular.fr-fieldset__legend - Sélectionnez une des valeurs - .fr-fieldset__element.fr-fieldset__element--inline - .fr-radio-group - = @form.radio_button :value, Individual::GENDER_FEMALE, id: @champ.female_input_id - %label.fr-label{ for: @champ.female_input_id } - = Individual.human_attribute_name('gender.female') - .fr-fieldset__element.fr-fieldset__element--inline - .fr-radio-group - = @form.radio_button :value, Individual::GENDER_MALE, id: @champ.male_input_id - %label.fr-label{ for: @champ.male_input_id } - = Individual.human_attribute_name('gender.male') + +.fr-fieldset__element.fr-fieldset__element--inline + .fr-radio-group + = @form.radio_button :value, Individual::GENDER_FEMALE, id: @champ.female_input_id + %label.fr-label{ for: @champ.female_input_id } + = Individual.human_attribute_name('gender.female') +.fr-fieldset__element.fr-fieldset__element--inline + .fr-radio-group + = @form.radio_button :value, Individual::GENDER_MALE, id: @champ.male_input_id + %label.fr-label{ for: @champ.male_input_id } + = Individual.human_attribute_name('gender.male') diff --git a/app/models/champs/civilite_champ.rb b/app/models/champs/civilite_champ.rb index 2f19c8009..00e1eb247 100644 --- a/app/models/champs/civilite_champ.rb +++ b/app/models/champs/civilite_champ.rb @@ -1,6 +1,10 @@ class Champs::CiviliteChamp < Champ validates :value, inclusion: ["M.", "Mme"], allow_nil: true, allow_blank: false + def legend_label? + true + end + def html_label? false end