diff --git a/app/components/editable_champ/drop_down_list_component.rb b/app/components/editable_champ/drop_down_list_component.rb index cd33efbdf..3b3be5a1d 100644 --- a/app/components/editable_champ/drop_down_list_component.rb +++ b/app/components/editable_champ/drop_down_list_component.rb @@ -2,7 +2,7 @@ class EditableChamp::DropDownListComponent < EditableChamp::EditableChampBaseComponent def render? - @champ.options? + @champ.drop_down_options.any? end def select_class_names diff --git a/app/components/editable_champ/linked_drop_down_list_component/linked_drop_down_list_component.html.haml b/app/components/editable_champ/linked_drop_down_list_component/linked_drop_down_list_component.html.haml index cd466d386..9ecebce20 100644 --- a/app/components/editable_champ/linked_drop_down_list_component/linked_drop_down_list_component.html.haml +++ b/app/components/editable_champ/linked_drop_down_list_component/linked_drop_down_list_component.html.haml @@ -1,4 +1,4 @@ -- if @champ.options? +- if @champ.drop_down_options.any? .fr-fieldset__element.fr-mb-0 .fr-select-group = render EditableChamp::ChampLabelComponent.new form: @form, champ: @champ, seen_at: @seen_at diff --git a/app/components/editable_champ/multiple_drop_down_list_component/multiple_drop_down_list_component.html.haml b/app/components/editable_champ/multiple_drop_down_list_component/multiple_drop_down_list_component.html.haml index 65136be64..15b4b3acb 100644 --- a/app/components/editable_champ/multiple_drop_down_list_component/multiple_drop_down_list_component.html.haml +++ b/app/components/editable_champ/multiple_drop_down_list_component/multiple_drop_down_list_component.html.haml @@ -1,4 +1,4 @@ -- if @champ.options? +- if @champ.drop_down_options.any? - if @champ.render_as_checkboxes? = @form.collection_check_boxes :value, @champ.enabled_non_empty_options, :to_s, :to_s do |b| - capture do diff --git a/app/models/champ.rb b/app/models/champ.rb index 7694177c9..20dcc3133 100644 --- a/app/models/champ.rb +++ b/app/models/champ.rb @@ -31,7 +31,6 @@ class Champ < ApplicationRecord :description, :drop_down_options, :drop_down_other?, - :drop_down_options?, :drop_down_list_enabled_non_empty_options, :drop_down_secondary_libelle, :drop_down_secondary_description, diff --git a/app/models/champs/drop_down_list_champ.rb b/app/models/champs/drop_down_list_champ.rb index 0204caa15..122151adb 100644 --- a/app/models/champs/drop_down_list_champ.rb +++ b/app/models/champs/drop_down_list_champ.rb @@ -16,10 +16,6 @@ class Champs::DropDownListChamp < Champ enabled_non_empty_options.size >= THRESHOLD_NB_OPTIONS_AS_AUTOCOMPLETE end - def options? - drop_down_options? - end - def html_label? !render_as_radios? end diff --git a/app/models/champs/linked_drop_down_list_champ.rb b/app/models/champs/linked_drop_down_list_champ.rb index 0cf99ad02..7bb349476 100644 --- a/app/models/champs/linked_drop_down_list_champ.rb +++ b/app/models/champs/linked_drop_down_list_champ.rb @@ -3,10 +3,6 @@ class Champs::LinkedDropDownListChamp < Champ delegate :primary_options, :secondary_options, to: :type_de_champ - def options? - drop_down_options? - end - def primary_value if value.present? JSON.parse(value)[0] diff --git a/app/models/champs/multiple_drop_down_list_champ.rb b/app/models/champs/multiple_drop_down_list_champ.rb index 93dbeafc0..3641100e7 100644 --- a/app/models/champs/multiple_drop_down_list_champ.rb +++ b/app/models/champs/multiple_drop_down_list_champ.rb @@ -3,10 +3,6 @@ class Champs::MultipleDropDownListChamp < Champ validate :values_are_in_options, if: -> { value.present? && validate_champ_value_or_prefill? } - def options? - drop_down_options? - end - def enabled_non_empty_options drop_down_list_enabled_non_empty_options end diff --git a/app/models/type_de_champ.rb b/app/models/type_de_champ.rb index 4b96b3b0c..aa33ad68a 100644 --- a/app/models/type_de_champ.rb +++ b/app/models/type_de_champ.rb @@ -566,10 +566,6 @@ class TypeDeChamp < ApplicationRecord end end - def drop_down_options? - drop_down_options.any? - end - def drop_down_options Array.wrap(super) end