diff --git a/app/components/editable_champ/drop_down_list_component.rb b/app/components/editable_champ/drop_down_list_component.rb index def70d331..ceed34675 100644 --- a/app/components/editable_champ/drop_down_list_component.rb +++ b/app/components/editable_champ/drop_down_list_component.rb @@ -1,2 +1,10 @@ class EditableChamp::DropDownListComponent < EditableChamp::EditableChampBaseComponent + def select_class_names + class_names('width-100': contains_long_option?) + end + + def contains_long_option? + max_length = 100 + @champ.options.any? { _1.size > max_length } + end end diff --git a/app/components/editable_champ/drop_down_list_component/drop_down_list_component.html.haml b/app/components/editable_champ/drop_down_list_component/drop_down_list_component.html.haml index f2369b33c..94f97cb65 100644 --- a/app/components/editable_champ/drop_down_list_component/drop_down_list_component.html.haml +++ b/app/components/editable_champ/drop_down_list_component/drop_down_list_component.html.haml @@ -16,7 +16,7 @@ = @form.radio_button :value, Champs::DropDownListChamp::OTHER, checked: @champ.other? Autre - else - = @form.select :value, @champ.options_without_empty_value_when_mandatory(@champ.options), { selected: @champ.selected }, required: @champ.required?, id: @champ.input_id, aria: { describedby: @champ.describedby_id } + = @form.select :value, @champ.options_without_empty_value_when_mandatory(@champ.options), { selected: @champ.selected }, required: @champ.required?, id: @champ.input_id, class: select_class_names, aria: { describedby: @champ.describedby_id } - if @champ.drop_down_other? = render EditableChamp::DropDownOtherInputComponent.new(form: @form, champ: @champ) diff --git a/app/components/editable_champ/section_component/section_component.html.haml b/app/components/editable_champ/section_component/section_component.html.haml index b6ecc682c..cc119bf2b 100644 --- a/app/components/editable_champ/section_component/section_component.html.haml +++ b/app/components/editable_champ/section_component/section_component.html.haml @@ -1,5 +1,5 @@ - if render_within_fieldset? - = tag.fieldset(class: "reset-#{tag_for_depth}") do + = tag.fieldset(class: "reset-#{tag_for_depth} fr-m-0 fr-p-0") do = tag.legend do = render EditableChamp::HeaderSectionComponent.new(champ: header_section) - splitted_tail.each do |section, champ|