homogenize render? if not options
This commit is contained in:
parent
f1a606da6d
commit
85684e3bea
4 changed files with 35 additions and 29 deletions
|
@ -5,6 +5,10 @@ class EditableChamp::LinkedDropDownListComponent < EditableChamp::EditableChampB
|
||||||
:fieldset
|
:fieldset
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def render?
|
||||||
|
@champ.drop_down_options.any?
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def secondary_label
|
def secondary_label
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
- if @champ.drop_down_options.any?
|
.fr-fieldset__element.fr-mb-0
|
||||||
.fr-fieldset__element.fr-mb-0
|
|
||||||
.fr-select-group
|
.fr-select-group
|
||||||
= render EditableChamp::ChampLabelComponent.new form: @form, champ: @champ, seen_at: @seen_at
|
= render EditableChamp::ChampLabelComponent.new form: @form, champ: @champ, seen_at: @seen_at
|
||||||
|
|
||||||
= @form.select :primary_value, @champ.primary_options, {}, required: @champ.required?, class: 'fr-select fr-mb-3v', id: @champ.input_id, aria: { describedby: @champ.describedby_id }
|
= @form.select :primary_value, @champ.primary_options, {}, required: @champ.required?, class: 'fr-select fr-mb-3v', id: @champ.input_id, aria: { describedby: @champ.describedby_id }
|
||||||
|
|
||||||
- if @champ.has_secondary_options_for_primary?
|
- if @champ.has_secondary_options_for_primary?
|
||||||
.secondary
|
.secondary
|
||||||
.fr-fieldset__element
|
.fr-fieldset__element
|
||||||
.fr-select-group
|
.fr-select-group
|
||||||
|
@ -15,5 +14,5 @@
|
||||||
.notice{ id: "#{@champ.describedby_id}-secondary" }
|
.notice{ id: "#{@champ.describedby_id}-secondary" }
|
||||||
= render SimpleFormatComponent.new(@champ.drop_down_secondary_description, allow_a: true)
|
= render SimpleFormatComponent.new(@champ.drop_down_secondary_description, allow_a: true)
|
||||||
= @form.select :secondary_value, @champ.secondary_options[@champ.primary_value], {}, required: @champ.required?, class: 'fr-select', id: "#{@champ.input_id}-secondary", aria: { describedby: "#{@champ.describedby_id}-secondary" }
|
= @form.select :secondary_value, @champ.secondary_options[@champ.primary_value], {}, required: @champ.required?, class: 'fr-select', id: "#{@champ.input_id}-secondary", aria: { describedby: "#{@champ.describedby_id}-secondary" }
|
||||||
- else
|
- else
|
||||||
= @form.hidden_field :secondary_value, value: ''
|
= @form.hidden_field :secondary_value, value: ''
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
- if @champ.drop_down_options.any?
|
- if @champ.render_as_checkboxes?
|
||||||
- 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.enabled_non_empty_options, :to_s, :to_s do |b|
|
||||||
- capture do
|
- capture do
|
||||||
.fr-fieldset__element
|
.fr-fieldset__element
|
||||||
|
@ -8,6 +7,6 @@
|
||||||
%label.fr-label{ for: @champ.checkbox_id(b.value) }
|
%label.fr-label{ for: @champ.checkbox_id(b.value) }
|
||||||
= b.text
|
= b.text
|
||||||
|
|
||||||
- else
|
- else
|
||||||
%react-fragment
|
%react-fragment
|
||||||
= render ReactComponent.new "ComboBox/MultiComboBox", **react_props
|
= render ReactComponent.new "ComboBox/MultiComboBox", **react_props
|
||||||
|
|
|
@ -88,6 +88,10 @@ class Champs::MultipleDropDownListChamp < Champ
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def render?
|
||||||
|
@champ.drop_down_options.any?
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def values_are_in_options
|
def values_are_in_options
|
||||||
|
|
Loading…
Add table
Reference in a new issue