refactor(js): more autosubmit controllers

This commit is contained in:
Paul Chavard 2023-01-12 17:55:01 +01:00
parent 3ea02b182a
commit a9d4ff85e6
2 changed files with 8 additions and 7 deletions

View file

@ -15,8 +15,8 @@
method: :put, method: :put,
url: allow_expert_review_admin_procedure_path(@procedure), url: allow_expert_review_admin_procedure_path(@procedure),
html: { class: 'form procedure-form__column--form no-background' } do |f| html: { class: 'form procedure-form__column--form no-background' } do |f|
%label.toggle-switch %label.toggle-switch{ data: { controller: 'autosubmit' } }
= f.check_box :allow_expert_review, class: 'toggle-switch-checkbox', onchange: 'this.form.requestSubmit()' = f.check_box :allow_expert_review, class: 'toggle-switch-checkbox'
%span.toggle-switch-control.round %span.toggle-switch-control.round
%span.toggle-switch-label.on %span.toggle-switch-label.on
%span.toggle-switch-label.off %span.toggle-switch-label.off
@ -29,8 +29,8 @@
method: :put, method: :put,
url: experts_require_administrateur_invitation_admin_procedure_path(@procedure), url: experts_require_administrateur_invitation_admin_procedure_path(@procedure),
html: { class: 'form procedure-form__column--form no-background' } do |f| html: { class: 'form procedure-form__column--form no-background' } do |f|
%label.toggle-switch %label.toggle-switch{ data: { controller: 'autosubmit' } }
= f.check_box :experts_require_administrateur_invitation, class: 'toggle-switch-checkbox', onchange: 'this.form.requestSubmit()' = f.check_box :experts_require_administrateur_invitation, class: 'toggle-switch-checkbox'
%span.toggle-switch-control.round %span.toggle-switch-control.round
%span.toggle-switch-label.on %span.toggle-switch-label.on
%span.toggle-switch-label.off %span.toggle-switch-label.off
@ -79,8 +79,8 @@
method: :put, method: :put,
data: { turbo: true }, data: { turbo: true },
html: { class: 'form procedure-form__column--form no-background' } do |f| html: { class: 'form procedure-form__column--form no-background' } do |f|
%label.toggle-switch %label.toggle-switch{ data: { controller: 'autosubmit' } }
= f.check_box :allow_decision_access, class: 'toggle-switch-checkbox', onchange: 'this.form.requestSubmit()' = f.check_box :allow_decision_access, class: 'toggle-switch-checkbox'
%span.toggle-switch-control.round %span.toggle-switch-control.round
%span.toggle-switch-label.on %span.toggle-switch-label.on
%span.toggle-switch-label.off %span.toggle-switch-label.off

View file

@ -5,9 +5,10 @@
= form_for procedure, = form_for procedure,
method: :patch, method: :patch,
url: update_instructeurs_self_management_enabled_admin_procedure_groupe_instructeurs_path(procedure), url: update_instructeurs_self_management_enabled_admin_procedure_groupe_instructeurs_path(procedure),
data: { controller: 'autosubmit', turbo: 'true' },
html: { class: 'form procedure-form__column--form no-background' } do |f| html: { class: 'form procedure-form__column--form no-background' } do |f|
%label.toggle-switch %label.toggle-switch
= f.check_box :instructeurs_self_management_enabled, class: 'toggle-switch-checkbox', onchange: 'this.form.submit()' = f.check_box :instructeurs_self_management_enabled, class: 'toggle-switch-checkbox'
%span.toggle-switch-control.round %span.toggle-switch-control.round
%span.toggle-switch-label.on %span.toggle-switch-label.on
%span.toggle-switch-label.off %span.toggle-switch-label.off