remove enabled_non_empty_options indirection
This commit is contained in:
parent
8b5f689a67
commit
cfb03fc747
6 changed files with 14 additions and 22 deletions
|
@ -23,7 +23,7 @@ class EditableChamp::DropDownListComponent < EditableChamp::EditableChampBaseCom
|
|||
|
||||
def contains_long_option?
|
||||
max_length = 100
|
||||
@champ.enabled_non_empty_options.any? { _1.size > max_length }
|
||||
@champ.drop_down_list_enabled_non_empty_options.any? { _1.size > max_length }
|
||||
end
|
||||
|
||||
def react_props
|
||||
|
@ -31,7 +31,7 @@ class EditableChamp::DropDownListComponent < EditableChamp::EditableChampBaseCom
|
|||
class: 'fr-mt-1w',
|
||||
name: @form.field_name(:value),
|
||||
selected_key: @champ.selected,
|
||||
items: @champ.enabled_non_empty_options(other: true).map { _1.is_a?(Array) ? _1 : [_1, _1] },
|
||||
items: @champ.drop_down_list_enabled_non_empty_options(other: true).map { _1.is_a?(Array) ? _1 : [_1, _1] },
|
||||
empty_filter_key: @champ.drop_down_other? ? Champs::DropDownListChamp::OTHER : nil,
|
||||
'aria-describedby': @champ.describedby_id,
|
||||
'aria-labelledby': @champ.labelledby_id)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
- if @champ.render_as_radios?
|
||||
.fr-fieldset__content
|
||||
- @champ.enabled_non_empty_options.each_with_index do |option, index|
|
||||
- @champ.drop_down_list_enabled_non_empty_options.each_with_index do |option, index|
|
||||
.fr-radio-group
|
||||
= @form.radio_button :value, option, id: dom_id(@champ, "radio_option_#{index}")
|
||||
%label.fr-label{ for: dom_id(@champ, "radio_option_#{index}") }
|
||||
|
@ -22,7 +22,7 @@
|
|||
= render ReactComponent.new "ComboBox/SingleComboBox", **react_props
|
||||
- else
|
||||
= @form.select :value,
|
||||
@champ.enabled_non_empty_options(other: true),
|
||||
@champ.drop_down_list_enabled_non_empty_options(other: true),
|
||||
{ selected: @champ.selected, include_blank: true },
|
||||
required: @champ.required?,
|
||||
id: @champ.input_id,
|
||||
|
|
|
@ -16,7 +16,7 @@ class EditableChamp::MultipleDropDownListComponent < EditableChamp::EditableCham
|
|||
class: 'fr-mt-1w',
|
||||
name: @form.field_name(:value, multiple: true),
|
||||
selected_keys: @champ.selected_options,
|
||||
items: @champ.enabled_non_empty_options,
|
||||
items: @champ.drop_down_list_enabled_non_empty_options,
|
||||
value_separator: false,
|
||||
'aria-label': @champ.libelle,
|
||||
'aria-describedby': @champ.describedby_id,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
- if @champ.render_as_checkboxes?
|
||||
= @form.collection_check_boxes :value, @champ.enabled_non_empty_options, :to_s, :to_s do |b|
|
||||
= @form.collection_check_boxes :value, @champ.drop_down_list_enabled_non_empty_options, :to_s, :to_s do |b|
|
||||
- capture do
|
||||
.fr-fieldset__element
|
||||
.fr-checkbox-group
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue