refactor(js): use autosubmit controller in procedure/all pages

This commit is contained in:
Paul Chavard 2023-01-11 21:47:44 +01:00
parent 289d48f697
commit c7c6d50df6
4 changed files with 11 additions and 11 deletions

View file

@ -1,6 +1,6 @@
- content_for :results do - content_for :results do
.main-filter-header.fr-my-3w .main-filter-header.fr-my-3w
= form_with(url: administrateurs_admin_procedures_path, method: :get, html: { 'data-autosubmit-target': 'form', 'data-turbo-frame': 'procedures', role: 'search' }) do |f| = form_with(url: administrateurs_admin_procedures_path, method: :get, data: { turbo_frame: 'procedures' }, html: { role: 'search' }) do |f|
- @filter.zone_ids&.each do |zone_id| - @filter.zone_ids&.each do |zone_id|
= hidden_field_tag 'zone_ids[]', zone_id = hidden_field_tag 'zone_ids[]', zone_id
- @filter.statuses&.each do |status| - @filter.statuses&.each do |status|
@ -14,7 +14,7 @@
%table#all-admins %table#all-admins
%caption %caption
= "#{@admins.total_count} administrateurs" = "#{@admins.total_count} administrateurs"
%span.hidden.fr-icon-ball-pen-fill{ 'aria-hidden': 'true', 'data-autosubmit-target': 'spinner' } %span.hidden.fr-icon-ball-pen-fill{ 'aria-hidden': 'true', 'data-turbo-target': 'spinner' }
- if @filter.email - if @filter.email
.selected-email.fr-mb-2w .selected-email.fr-mb-2w
= link_to @filter.email, administrateurs_admin_procedures_path(@filter.without(:email)), class: 'fr-tag fr-tag--dismiss fr-mb-1w' = link_to @filter.email, administrateurs_admin_procedures_path(@filter.without(:email)), class: 'fr-tag fr-tag--dismiss fr-mb-1w'

View file

@ -1,6 +1,6 @@
- content_for :results do - content_for :results do
.main-filter-header.fr-my-3w .main-filter-header.fr-my-3w
= form_with(url: all_admin_procedures_path, method: :get, html: { 'data-autosubmit-target': 'form', 'data-turbo-frame': 'procedures', role: 'search', class: 'search' }) do |f| = form_with(url: all_admin_procedures_path, method: :get, data: { turbo_frame: 'procedures' }, html: { role: 'search', class: 'search' }) do |f|
- @filter.zone_ids&.each do |zone_id| - @filter.zone_ids&.each do |zone_id|
= hidden_field_tag 'zone_ids[]', zone_id = hidden_field_tag 'zone_ids[]', zone_id
- @filter.statuses&.each do |status| - @filter.statuses&.each do |status|
@ -16,7 +16,7 @@
%table#all-demarches %table#all-demarches
%caption %caption
= "#{@procedures.total_count} démarches" = "#{@procedures.total_count} démarches"
%span.hidden.fr-icon-ball-pen-fill{ 'aria-hidden': 'true', 'data-autosubmit-target': 'spinner' } %span.hidden.fr-icon-ball-pen-fill{ 'aria-hidden': 'true', 'data-turbo-target': 'spinner' }
- if @filter.libelle - if @filter.libelle
.selected-query.fr-mb-2w .selected-query.fr-mb-2w
= link_to @filter.libelle, all_admin_procedures_path(@filter.without(:libelle)), class: 'fr-tag fr-tag--dismiss fr-mb-1w' = link_to @filter.libelle, all_admin_procedures_path(@filter.without(:libelle)), class: 'fr-tag fr-tag--dismiss fr-mb-1w'

View file

@ -9,10 +9,10 @@
.fr-highlight.fr-mb-4w .fr-highlight.fr-mb-4w
%p Ce tableau de bord permet de consulter les informations sur les démarches simplifiées pour toutes les zones. Filtrez par zone et statut. Consultez la liste des démarches et cliquez sur une démarche pour voir la zone et quels sont les administrateurs. %p Ce tableau de bord permet de consulter les informations sur les démarches simplifiées pour toutes les zones. Filtrez par zone et statut. Consultez la liste des démarches et cliquez sur une démarche pour voir la zone et quels sont les administrateurs.
.fr-container--fluid{ 'data-turbo': 'true', 'data-controller': 'autosubmit' } .fr-container--fluid{ data: { turbo: 'true' } }
.fr-grid-row.fr-grid-row--gutters .fr-grid-row.fr-grid-row--gutters
.fr-col-3 .fr-col-3
= form_with(url: all_admin_procedures_path, method: :get, html: { 'data-autosubmit-target': 'form', 'data-turbo-frame': 'procedures' }) do |f| = form_with(url: all_admin_procedures_path, method: :get, data: { controller: 'autosubmit', turbo_frame: 'procedures' }) do |f|
%fieldset.sidebar-filter %fieldset.sidebar-filter
%legend %legend
@ -31,7 +31,7 @@
.fr-ml-1w{ 'data-expand-target': 'content' } .fr-ml-1w{ 'data-expand-target': 'content' }
= f.collection_check_boxes :zone_ids, @filter.admin_zones, :id, :current_label, include_hidden: false do |b| = f.collection_check_boxes :zone_ids, @filter.admin_zones, :id, :current_label, include_hidden: false do |b|
.fr-checkbox-group.fr-ml-2w.fr-py-1w .fr-checkbox-group.fr-ml-2w.fr-py-1w
= b.check_box(checked: @filter.zone_filtered?(b.value), 'data-action': 'autosubmit#submit') = b.check_box(checked: @filter.zone_filtered?(b.value))
= b.label(class: 'fr-label') { b.text } = b.label(class: 'fr-label') { b.text }
%li.fr-py-2w.fr-pl-2w{ 'data-controller': "expand" } %li.fr-py-2w.fr-pl-2w{ 'data-controller': "expand" }
.fr-mb-1w .fr-mb-1w
@ -41,7 +41,7 @@
.fr-ml-1w.hidden{ 'data-expand-target': 'content' } .fr-ml-1w.hidden{ 'data-expand-target': 'content' }
= f.collection_check_boxes :zone_ids, @filter.other_zones, :id, :current_label, include_hidden: false do |b| = f.collection_check_boxes :zone_ids, @filter.other_zones, :id, :current_label, include_hidden: false do |b|
.fr-checkbox-group.fr-ml-2w.fr-py-1w .fr-checkbox-group.fr-ml-2w.fr-py-1w
= b.check_box(checked: @filter.zone_filtered?(b.value), 'data-action': 'autosubmit#submit') = b.check_box(checked: @filter.zone_filtered?(b.value))
= b.label(class: 'fr-label') { b.text } = b.label(class: 'fr-label') { b.text }
%li.fr-py-2w{ 'data-controller': "expand" } %li.fr-py-2w{ 'data-controller': "expand" }
.fr-mb-1w.fr-pl-2w .fr-mb-1w.fr-pl-2w
@ -51,7 +51,7 @@
.fr-input-group.hidden{ 'data-expand-target': 'content' } .fr-input-group.hidden{ 'data-expand-target': 'content' }
= f.label 'from_publication_date', 'Depuis', class: 'fr-label' = f.label 'from_publication_date', 'Depuis', class: 'fr-label'
.fr-input-wrap.fr-fi-calendar-line .fr-input-wrap.fr-fi-calendar-line
= f.date_field 'from_publication_date', value: @filter.from_publication_date, class: 'fr-input', 'data-action': 'blur->autosubmit#submit change->autosubmit#debouncedSubmit' = f.date_field 'from_publication_date', value: @filter.from_publication_date, class: 'fr-input'
%li.fr-py-2w.fr-pl-2w{ 'data-controller': "expand" } %li.fr-py-2w.fr-pl-2w{ 'data-controller': "expand" }
.fr-mb-1w .fr-mb-1w
@ -61,7 +61,7 @@
.fr-ml-1w.hidden{ 'data-expand-target': 'content' } .fr-ml-1w.hidden{ 'data-expand-target': 'content' }
= f.collection_check_boxes :statuses, ['publiee', 'close'], :to_s, :to_s, include_hidden: false do |b| = f.collection_check_boxes :statuses, ['publiee', 'close'], :to_s, :to_s, include_hidden: false do |b|
.fr-checkbox-group.fr-ml-2w.fr-py-1w .fr-checkbox-group.fr-ml-2w.fr-py-1w
= b.check_box(checked: @filter.status_filtered?(b.value), 'data-action': 'autosubmit#submit') = b.check_box(checked: @filter.status_filtered?(b.value))
= b.label(class: 'fr-label') { t b.text, scope: 'activerecord.attributes.procedure.aasm_state' } = b.label(class: 'fr-label') { t b.text, scope: 'activerecord.attributes.procedure.aasm_state' }
%turbo-frame#procedures.fr-col-9{ 'data-turbo-action': 'advance' } %turbo-frame#procedures.fr-col-9{ 'data-turbo-action': 'advance' }

View file

@ -35,7 +35,7 @@
= yield(:invisible_captcha_styles) = yield(:invisible_captcha_styles)
%body{ { id: content_for(:page_id), class: browser.platform.ios? ? 'ios' : nil }.compact } %body{ { id: content_for(:page_id), class: browser.platform.ios? ? 'ios' : nil, data: { controller: 'turbo' } }.compact }
= render partial: 'layouts/skiplinks' = render partial: 'layouts/skiplinks'
.page-wrapper .page-wrapper
= render partial: "layouts/outdated_browser_banner" = render partial: "layouts/outdated_browser_banner"