Merge pull request #9154 from colinux/fix-form-owned-button-turbo

ETQ utilisateur je veux que mes PJ soient supprimées en turbo
This commit is contained in:
Colin Darie 2023-06-12 11:59:56 +00:00 committed by GitHub
commit 628026f524
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 4 additions and 4 deletions

View file

@ -7,7 +7,7 @@
- else
%div{ 'data-turbo-focus-group': true }
- if @champ.selected_options.present?
.fr-mb-2w{ "data-turbo": "true" }
.fr-mb-2w
- @champ.selected_options.each do |option|
= render NestedForms::OwnedButtonComponent.new(formaction: champs_options_path(@champ.id, option:), http_method: :delete, opt: { class: 'fr-tag fr-tag--dismiss fr-mb-1w fr-mr-1w', id: @champ.checkbox_id(option) }) do
= option

View file

@ -8,6 +8,6 @@
- @champ.rows.each do |champs|
= render EditableChamp::RepetitionRowComponent.new(form: @form, champ: @champ, row: champs, seen_at: @seen_at)
.actions{ 'data-turbo': 'true' }
.actions
= render NestedForms::OwnedButtonComponent.new(formaction: champs_repetition_path(@champ.id), http_method: :create, opt: { class: "fr-btn fr-btn--secondary fr-btn--icon-left fr-icon-add-circle-line fr-mb-3w", title: t(".add_title", libelle: @champ.libelle), id: dom_id(@champ, :create_repetition)}) do
= t(".add", libelle: @champ.libelle)

View file

@ -7,6 +7,6 @@
- else
= render EditableChamp::SectionComponent.new(champs: @row)
.flex.row-reverse{ 'data-turbo': 'true' }
.flex.row-reverse
= render NestedForms::OwnedButtonComponent.new(formaction: champs_repetition_path(@champ.id, row_id: @row.first.row_id), http_method: :delete, opt: { class: "fr-btn fr-btn--sm fr-btn--tertiary fr-text-action-high--red-marianne", title: t(".delete_title", row_number: @champ.rows.find_index(@row))}) do
= t(".delete")

View file

@ -8,6 +8,6 @@ class NestedForms::OwnedButtonComponent < ApplicationComponent
end
def call
button_tag(content, @opt.merge(formaction: @formaction, form: NestedForms::FormOwnerComponent.form_id(@http_method)))
button_tag(content, @opt.merge(formaction: @formaction, form: NestedForms::FormOwnerComponent.form_id(@http_method), data: { turbo: 'true' }))
end
end