one less indirection
This commit is contained in:
parent
b3ad237fa1
commit
f1a606da6d
8 changed files with 3 additions and 20 deletions
|
@ -2,7 +2,7 @@
|
|||
|
||||
class EditableChamp::DropDownListComponent < EditableChamp::EditableChampBaseComponent
|
||||
def render?
|
||||
@champ.options?
|
||||
@champ.drop_down_options.any?
|
||||
end
|
||||
|
||||
def select_class_names
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue