refactor(condition): use dom_id with stable_id
This commit is contained in:
parent
0adfd92213
commit
98a0bc8c71
3 changed files with 8 additions and 3 deletions
|
@ -1,4 +1,4 @@
|
||||||
.flex.justify-start.section{ id: "conditions_type_de_champ_#{@tdc.stable_id}" }
|
.flex.justify-start.section{ id: dom_id(@tdc.stable_self, :conditions) }
|
||||||
= form_with url: admin_procedure_condition_path(@procedure_id, @tdc.stable_id), method: :patch, class: 'form width-100' do |f|
|
= form_with url: admin_procedure_condition_path(@procedure_id, @tdc.stable_id), method: :patch, class: 'form width-100' do |f|
|
||||||
.conditionnel.mt-2.width-100
|
.conditionnel.mt-2.width-100
|
||||||
.flex
|
.flex
|
||||||
|
|
|
@ -360,6 +360,11 @@ class TypeDeChamp < ApplicationRecord
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def stable_self
|
||||||
|
OpenStruct.new(to_key: [stable_id],
|
||||||
|
model_name: OpenStruct.new(param_key: model_name.param_key))
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
DEFAULT_EMPTY = ['']
|
DEFAULT_EMPTY = ['']
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
- rendered = render @condition_component
|
- rendered = render @condition_component
|
||||||
|
|
||||||
- if rendered.present?
|
- if rendered.present?
|
||||||
= turbo_stream.morph "conditions_type_de_champ_#{@tdc.stable_id}" do
|
= turbo_stream.morph dom_id(@tdc.stable_self, :conditions) do
|
||||||
- rendered
|
- rendered
|
||||||
end
|
end
|
||||||
- else
|
- else
|
||||||
= turbo_stream.remove "conditions_type_de_champ_#{@tdc.stable_id}"
|
= turbo_stream.remove dom_id(@tdc.stable_self, :conditions)
|
||||||
|
|
Loading…
Reference in a new issue