Merge pull request #9652 from colinux/fix-dropdown-other-markup
Usager: fix alignement du champ "autre" des listes de choix
This commit is contained in:
commit
8c6489fae2
2 changed files with 37 additions and 29 deletions
|
@ -1,4 +1,8 @@
|
||||||
class EditableChamp::DropDownListComponent < EditableChamp::EditableChampBaseComponent
|
class EditableChamp::DropDownListComponent < EditableChamp::EditableChampBaseComponent
|
||||||
|
def render?
|
||||||
|
@champ.options?
|
||||||
|
end
|
||||||
|
|
||||||
def select_class_names
|
def select_class_names
|
||||||
class_names('width-100': contains_long_option?, 'fr-select': true)
|
class_names('width-100': contains_long_option?, 'fr-select': true)
|
||||||
end
|
end
|
||||||
|
@ -11,6 +15,10 @@ class EditableChamp::DropDownListComponent < EditableChamp::EditableChampBaseCom
|
||||||
@champ.render_as_radios? ? :fieldset : :div
|
@champ.render_as_radios? ? :fieldset : :div
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def other_element_class_names
|
||||||
|
class_names("fr-fieldset__element" => dsfr_champ_container == :fieldset)
|
||||||
|
end
|
||||||
|
|
||||||
def contains_long_option?
|
def contains_long_option?
|
||||||
max_length = 100
|
max_length = 100
|
||||||
@champ.enabled_non_empty_options.any? { _1.size > max_length }
|
@champ.enabled_non_empty_options.any? { _1.size > max_length }
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
- if @champ.options?
|
|
||||||
- if @champ.render_as_radios?
|
- if @champ.render_as_radios?
|
||||||
.fr-fieldset__content
|
.fr-fieldset__content
|
||||||
- @champ.enabled_non_empty_options.each_with_index do |option, index|
|
- @champ.enabled_non_empty_options.each_with_index do |option, index|
|
||||||
|
@ -30,4 +29,5 @@
|
||||||
aria: { describedby: @champ.describedby_id }
|
aria: { describedby: @champ.describedby_id }
|
||||||
|
|
||||||
- if @champ.drop_down_other?
|
- if @champ.drop_down_other?
|
||||||
|
%div{ class: other_element_class_names }
|
||||||
= render EditableChamp::DropDownOtherInputComponent.new(form: @form, champ: @champ)
|
= render EditableChamp::DropDownOtherInputComponent.new(form: @form, champ: @champ)
|
||||||
|
|
Loading…
Reference in a new issue