conditions_component use stable_id

This commit is contained in:
simon lehericey 2022-07-13 11:16:43 +02:00
parent 17715d6556
commit 00c4076b32
2 changed files with 6 additions and 6 deletions

View file

@ -22,7 +22,7 @@ class TypesDeChampEditor::ConditionsComponent < ApplicationComponent
def logic_conditionnel_button def logic_conditionnel_button
if @condition.nil? if @condition.nil?
submit_tag(t('.enable_conditionnel'), formaction: add_row_admin_procedure_condition_path(@procedure_id, @tdc.id)) submit_tag(t('.enable_conditionnel'), formaction: add_row_admin_procedure_condition_path(@procedure_id, @tdc.stable_id))
else else
submit_tag( submit_tag(
t('.disable_conditionnel'), t('.disable_conditionnel'),
@ -185,7 +185,7 @@ class TypesDeChampEditor::ConditionsComponent < ApplicationComponent
def add_condition_tag def add_condition_tag
tag.button( tag.button(
tag.span('', class: 'icon add') + tag.span(t('.add_condition')), tag.span('', class: 'icon add') + tag.span(t('.add_condition')),
formaction: add_row_admin_procedure_condition_path(@procedure_id, @tdc.id), formaction: add_row_admin_procedure_condition_path(@procedure_id, @tdc.stable_id),
formnovalidate: true, formnovalidate: true,
class: 'add-row' class: 'add-row'
) )
@ -194,7 +194,7 @@ class TypesDeChampEditor::ConditionsComponent < ApplicationComponent
def delete_condition_tag(row_index) def delete_condition_tag(row_index)
tag.button( tag.button(
tag.span('', class: 'icon delete') + tag.span(t('.remove_a_row'), class: 'sr-only'), tag.span('', class: 'icon delete') + tag.span(t('.remove_a_row'), class: 'sr-only'),
formaction: delete_row_admin_procedure_condition_path(@procedure_id, @tdc.id, row_index: row_index), formaction: delete_row_admin_procedure_condition_path(@procedure_id, @tdc.stable_id, row_index: row_index),
formmethod: 'delete', formmethod: 'delete',
formnovalidate: true formnovalidate: true
) )
@ -209,7 +209,7 @@ class TypesDeChampEditor::ConditionsComponent < ApplicationComponent
end end
def input_id_for(name, row_index) def input_id_for(name, row_index)
"#{@tdc.id}-#{name}-#{row_index}" "#{@tdc.stable_id}-#{name}-#{row_index}"
end end
def input_prefix def input_prefix

View file

@ -1,5 +1,5 @@
.flex.justify-start.section{ id: dom_id(@tdc, :conditions) } .flex.justify-start.section{ id: "conditions_type_de_champ_#{@tdc.stable_id}" }
= form_with url: admin_procedure_condition_path(@procedure_id, @tdc), 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
%p.mr-2 Logique conditionnelle %p.mr-2 Logique conditionnelle