fix(form): conditional hides fieldset__element so vertical margins are not cumulated
This commit is contained in:
parent
7b9f44ec42
commit
9e5ade817a
3 changed files with 16 additions and 12 deletions
|
@ -30,15 +30,20 @@ class EditableChamp::EditableChampComponent < ApplicationComponent
|
|||
{
|
||||
'editable-champ': true,
|
||||
"editable-champ-#{@champ.type_champ}": true,
|
||||
"hidden": !@champ.visible?,
|
||||
champ_component.dsfr_group_classname => true
|
||||
}.merge(champ_component.input_group_error_class_names)
|
||||
),
|
||||
id: @champ.input_group_id,
|
||||
data: { controller: stimulus_controller, **data_dependent_conditions, **stimulus_values }
|
||||
}
|
||||
end
|
||||
|
||||
def fieldset_element_attributes
|
||||
{
|
||||
id: @champ.input_group_id,
|
||||
"hidden": !@champ.visible?
|
||||
}
|
||||
end
|
||||
|
||||
def stimulus_values
|
||||
if @champ.fetch_external_data_pending?
|
||||
{ turbo_poll_url_value: }
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
.fr-fieldset__element{ **fieldset_element_attributes }
|
||||
= content_tag((champ_component.dsfr_champ_container), html_options) do
|
||||
- if has_label?(@champ)
|
||||
= render EditableChamp::ChampLabelComponent.new form: @form, champ: @champ, seen_at: @seen_at
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
= render section
|
||||
- else
|
||||
= fields_for champ.input_name, champ do |form|
|
||||
.fr-fieldset__element
|
||||
= render EditableChamp::EditableChampComponent.new form:, champ:
|
||||
- else
|
||||
%fieldset.fr-fieldset.fr-my-0
|
||||
|
@ -20,5 +19,4 @@
|
|||
= render section
|
||||
- else
|
||||
= fields_for champ.input_name, champ do |form|
|
||||
.fr-fieldset__element
|
||||
= render EditableChamp::EditableChampComponent.new form:, champ:
|
||||
|
|
Loading…
Reference in a new issue