From 1c20a9160c1cfdfcceac7f2ea3bbe995f0bda529 Mon Sep 17 00:00:00 2001 From: Lisa Durand Date: Fri, 21 Apr 2023 17:19:17 +0200 Subject: [PATCH] add dsfr style pagination for all users --- app/views/administrate/application/_pagination.html.haml | 2 +- .../administrateurs/groupe_instructeurs/_edit.html.haml | 2 +- .../groupe_instructeurs/_instructeurs.html.haml | 2 +- .../groupe_instructeurs/reaffecter_dossiers.html.haml | 2 +- .../administrateurs/procedures/administrateurs.html.haml | 4 ++-- app/views/administrateurs/procedures/all.html.haml | 4 ++-- app/views/administrateurs/procedures/index.html.haml | 8 ++++---- app/views/experts/avis/procedure.html.haml | 2 +- .../instructeurs/groupe_instructeurs/index.html.haml | 2 +- app/views/instructeurs/groupe_instructeurs/show.html.haml | 2 +- .../instructeurs/procedures/deleted_dossiers.html.haml | 4 ++-- app/views/instructeurs/procedures/show.html.haml | 3 ++- app/views/recherche/index.html.haml | 4 ++-- .../kaminari/_first_page.html.haml | 0 .../{administrateurs => shared}/kaminari/_gap.html.haml | 0 .../kaminari/_last_page.html.haml | 0 .../kaminari/_next_page.html.haml | 0 .../{administrateurs => shared}/kaminari/_page.html.haml | 0 .../kaminari/_paginator.html.haml | 2 +- .../kaminari/_prev_page.html.haml | 0 app/views/users/dossiers/_deleted_dossiers_list.html.haml | 2 +- app/views/users/dossiers/_dossiers_list.html.haml | 2 +- app/views/users/dossiers/_hidden_dossiers_list.html.haml | 2 +- .../users/dossiers/_transfered_dossiers_list.html.haml | 2 +- 24 files changed, 26 insertions(+), 25 deletions(-) rename app/views/{administrateurs => shared}/kaminari/_first_page.html.haml (100%) rename app/views/{administrateurs => shared}/kaminari/_gap.html.haml (100%) rename app/views/{administrateurs => shared}/kaminari/_last_page.html.haml (100%) rename app/views/{administrateurs => shared}/kaminari/_next_page.html.haml (100%) rename app/views/{administrateurs => shared}/kaminari/_page.html.haml (100%) rename app/views/{administrateurs => shared}/kaminari/_paginator.html.haml (82%) rename app/views/{administrateurs => shared}/kaminari/_prev_page.html.haml (100%) diff --git a/app/views/administrate/application/_pagination.html.haml b/app/views/administrate/application/_pagination.html.haml index 16cc79876..6160626fb 100644 --- a/app/views/administrate/application/_pagination.html.haml +++ b/app/views/administrate/application/_pagination.html.haml @@ -3,4 +3,4 @@ = link_to_prev_page resources, t("views.pagination.previous"), param_name: "_page" = link_to_next_page resources, t("views.pagination.next"), param_name: "_page" - else - = paginate resources, param_name: "_page" + = paginate resources, param_name: "_page", views_prefix: 'shared' diff --git a/app/views/administrateurs/groupe_instructeurs/_edit.html.haml b/app/views/administrateurs/groupe_instructeurs/_edit.html.haml index b5ea5e640..fdf5e95f5 100644 --- a/app/views/administrateurs/groupe_instructeurs/_edit.html.haml +++ b/app/views/administrateurs/groupe_instructeurs/_edit.html.haml @@ -64,4 +64,4 @@ = t('.group_management.move_files', count: group.dossiers.visible_by_administration.size) - = paginate groupes_instructeurs + = paginate groupes_instructeurs, views_prefix: 'shared' diff --git a/app/views/administrateurs/groupe_instructeurs/_instructeurs.html.haml b/app/views/administrateurs/groupe_instructeurs/_instructeurs.html.haml index b5ec688d7..bc2a07f12 100644 --- a/app/views/administrateurs/groupe_instructeurs/_instructeurs.html.haml +++ b/app/views/administrateurs/groupe_instructeurs/_instructeurs.html.haml @@ -39,4 +39,4 @@ params: { instructeur: { id: instructeur.id }}, class: 'fr-btn fr-btn--secondary' } - = paginate instructeurs + = paginate instructeurs, views_prefix: 'shared' diff --git a/app/views/administrateurs/groupe_instructeurs/reaffecter_dossiers.html.haml b/app/views/administrateurs/groupe_instructeurs/reaffecter_dossiers.html.haml index 930628eba..7a54ec124 100644 --- a/app/views/administrateurs/groupe_instructeurs/reaffecter_dossiers.html.haml +++ b/app/views/administrateurs/groupe_instructeurs/reaffecter_dossiers.html.haml @@ -23,4 +23,4 @@ { class: 'button', data: { confirm: "Êtes-vous sûr de vouloir réaffecter les dossiers du groupe « #{@groupe_instructeur.label} » vers le groupe  « #{group.label} » ?" } } - = paginate @groupes_instructeurs + = paginate @groupes_instructeurs, views_prefix: 'shared' diff --git a/app/views/administrateurs/procedures/administrateurs.html.haml b/app/views/administrateurs/procedures/administrateurs.html.haml index de7daa525..5f2369d5c 100644 --- a/app/views/administrateurs/procedures/administrateurs.html.haml +++ b/app/views/administrateurs/procedures/administrateurs.html.haml @@ -29,7 +29,7 @@ - if @filter.from_publication_date.present? .selected-from-publication-date.fr-mb-2w = link_to "Depuis le #{l(@filter.from_publication_date)}", all_admin_procedures_path(@filter.without(:from_publication_date)), class: 'fr-tag fr-tag--dismiss fr-mb-1w' - = paginate @admins, views_prefix: 'administrateurs' + = paginate @admins, views_prefix: 'shared' %thead %tr %th{ scope: 'col' } @@ -51,4 +51,4 @@ %ul - admin.procedures.each do |procedure| %li= procedure.libelle - .fr-mt-2w= paginate @admins, views_prefix: 'administrateurs' + .fr-mt-2w= paginate @admins, views_prefix: 'shared' diff --git a/app/views/administrateurs/procedures/all.html.haml b/app/views/administrateurs/procedures/all.html.haml index 65d136b1c..0032d085f 100644 --- a/app/views/administrateurs/procedures/all.html.haml +++ b/app/views/administrateurs/procedures/all.html.haml @@ -38,7 +38,7 @@ - if @filter.from_publication_date.present? .selected-from-publication-date.fr-mb-2w = link_to "Depuis #{l(@filter.from_publication_date)}", all_admin_procedures_path(@filter.without(:from_publication_date)), class: 'fr-tag fr-tag--dismiss fr-mb-1w' - = paginate @procedures, params: @filter.params, views_prefix: 'administrateurs' + = paginate @procedures, params: @filter.params, , views_prefix: 'shared' %thead %tr %th{ scope: 'col' } @@ -52,4 +52,4 @@ %tbody{ 'data-turbo': 'true' } - @procedures.each do |procedure| = render partial: 'detail', locals: { procedure: procedure, show_detail: false } - .fr-mt-2w= paginate @procedures, params: @filter.params, views_prefix: 'administrateurs' + .fr-mt-2w= paginate @procedures, params: @filter.params, views_prefix: 'shared' diff --git a/app/views/administrateurs/procedures/index.html.haml b/app/views/administrateurs/procedures/index.html.haml index b29e49b81..2b883791c 100644 --- a/app/views/administrateurs/procedures/index.html.haml +++ b/app/views/administrateurs/procedures/index.html.haml @@ -15,16 +15,16 @@ .fr-container#procedures{ data: { item_count: @statut === "publiees" ? @procedures_publiees_count : @statut === "brouillons" ? @procedures_draft_count : @procedures_closed_count } } - if @statut === "publiees" = render partial: "procedures_list", locals: { procedures: @procedures_publiees } - = paginate @procedures_publiees + = paginate @procedures_publiees, views_prefix: 'shared' - if @statut === "brouillons" = render partial: "procedures_list", locals: { procedures: @procedures_draft } - = paginate @procedures_draft + = paginate @procedures_draft, views_prefix: 'shared' - if @statut === "archivees" = render partial: "procedures_list", locals: { procedures: @procedures_closed } - = paginate @procedures_closed + = paginate @procedures_closed, views_prefix: 'shared' - if @statut === "supprimees" = render partial: "procedures_list", locals: { procedures: @procedures_deleted } - = paginate @procedures_deleted + = paginate @procedures_deleted, views_prefix: 'shared' diff --git a/app/views/experts/avis/procedure.html.haml b/app/views/experts/avis/procedure.html.haml index 547d633f9..c8fc2f1cb 100644 --- a/app/views/experts/avis/procedure.html.haml +++ b/app/views/experts/avis/procedure.html.haml @@ -41,6 +41,6 @@ #{avis.dossier.id} %td= link_to(avis.dossier.user_email_for(:display), expert_avis_path(avis.procedure, avis), class: 'cell-link') %td= link_to(avis.procedure.libelle, expert_avis_path(avis.procedure, avis), class: 'cell-link') - = paginate(@avis) + = paginate @avis, views_prefix: 'shared' - else %h2.empty-text Aucun avis diff --git a/app/views/instructeurs/groupe_instructeurs/index.html.haml b/app/views/instructeurs/groupe_instructeurs/index.html.haml index 6f4a28f12..2cac708f4 100644 --- a/app/views/instructeurs/groupe_instructeurs/index.html.haml +++ b/app/views/instructeurs/groupe_instructeurs/index.html.haml @@ -17,4 +17,4 @@ %td= group.label %td.actions= link_to "voir", instructeur_groupe_path(@procedure, group) - = paginate @groupes_instructeurs + = paginate @groupes_instructeurs, views_prefix: 'shared' diff --git a/app/views/instructeurs/groupe_instructeurs/show.html.haml b/app/views/instructeurs/groupe_instructeurs/show.html.haml index 873adfca6..ef16232c2 100644 --- a/app/views/instructeurs/groupe_instructeurs/show.html.haml +++ b/app/views/instructeurs/groupe_instructeurs/show.html.haml @@ -47,4 +47,4 @@ params: { instructeur: { id: instructeur.id }}, class: 'button' } - = paginate @instructeurs + = paginate @instructeurs, views_prefix: 'shared' diff --git a/app/views/instructeurs/procedures/deleted_dossiers.html.haml b/app/views/instructeurs/procedures/deleted_dossiers.html.haml index 32d81df04..d82db343c 100644 --- a/app/views/instructeurs/procedures/deleted_dossiers.html.haml +++ b/app/views/instructeurs/procedures/deleted_dossiers.html.haml @@ -34,7 +34,7 @@ %li L’utilisateur a intentionnellement supprimé son dossier. %li Le délai de conservation maximal de #{@procedure.duree_conservation_dossiers_dans_ds} mois a expiré. Conformément au règlement RGPD, DS ne peut continuer à les héberger. - if @deleted_dossiers.any? - = paginate @deleted_dossiers + = paginate @deleted_dossiers, views_prefix: 'shared' %table.table.dossiers-table.hoverable %thead %tr @@ -53,6 +53,6 @@ = deletion_reason_badge(deleted_dossier.reason) %td.deleted-cell = l(deleted_dossier.deleted_at, format: '%d/%m/%y') - = paginate @deleted_dossiers + = paginate @deleted_dossiers, views_prefix: 'shared' - else Aucun dossier supprimé diff --git a/app/views/instructeurs/procedures/show.html.haml b/app/views/instructeurs/procedures/show.html.haml index 9796192d1..a780d57f1 100644 --- a/app/views/instructeurs/procedures/show.html.haml +++ b/app/views/instructeurs/procedures/show.html.haml @@ -184,7 +184,8 @@ turbo: false } %tfoot %tr - %td.force-table-100{ colspan: @procedure_presentation.displayed_fields_for_headers.size + 2 }= paginate @filtered_sorted_paginated_ids + %td.force-table-100{ colspan: @procedure_presentation.displayed_fields_for_headers.size + 2 } + = paginate @filtered_sorted_paginated_ids, views_prefix: 'shared' - else %h2.empty-text diff --git a/app/views/recherche/index.html.haml b/app/views/recherche/index.html.haml index 2057de441..d98aeef72 100644 --- a/app/views/recherche/index.html.haml +++ b/app/views/recherche/index.html.haml @@ -11,7 +11,7 @@ = t('pluralize.dossier_trouve', count: @dossiers_count) - if @projected_dossiers.present? - = paginate @paginated_ids + = paginate @paginated_ids, views_prefix: 'shared' .fr-table.fr-table--bordered %table.table.dossiers-table.hoverable %thead @@ -105,7 +105,7 @@ - else %td - = paginate @paginated_ids + = paginate @paginated_ids, views_prefix: 'shared' - else %h2 Aucun dossier correspondant à votre recherche n’a été trouvé diff --git a/app/views/administrateurs/kaminari/_first_page.html.haml b/app/views/shared/kaminari/_first_page.html.haml similarity index 100% rename from app/views/administrateurs/kaminari/_first_page.html.haml rename to app/views/shared/kaminari/_first_page.html.haml diff --git a/app/views/administrateurs/kaminari/_gap.html.haml b/app/views/shared/kaminari/_gap.html.haml similarity index 100% rename from app/views/administrateurs/kaminari/_gap.html.haml rename to app/views/shared/kaminari/_gap.html.haml diff --git a/app/views/administrateurs/kaminari/_last_page.html.haml b/app/views/shared/kaminari/_last_page.html.haml similarity index 100% rename from app/views/administrateurs/kaminari/_last_page.html.haml rename to app/views/shared/kaminari/_last_page.html.haml diff --git a/app/views/administrateurs/kaminari/_next_page.html.haml b/app/views/shared/kaminari/_next_page.html.haml similarity index 100% rename from app/views/administrateurs/kaminari/_next_page.html.haml rename to app/views/shared/kaminari/_next_page.html.haml diff --git a/app/views/administrateurs/kaminari/_page.html.haml b/app/views/shared/kaminari/_page.html.haml similarity index 100% rename from app/views/administrateurs/kaminari/_page.html.haml rename to app/views/shared/kaminari/_page.html.haml diff --git a/app/views/administrateurs/kaminari/_paginator.html.haml b/app/views/shared/kaminari/_paginator.html.haml similarity index 82% rename from app/views/administrateurs/kaminari/_paginator.html.haml rename to app/views/shared/kaminari/_paginator.html.haml index 4c535c675..9c018cf5f 100644 --- a/app/views/administrateurs/kaminari/_paginator.html.haml +++ b/app/views/shared/kaminari/_paginator.html.haml @@ -1,5 +1,5 @@ = paginator.render do - %nav.fr-pagination{ role: 'navigation', 'aria-label': 'Pagination' } + %nav.fr-pagination.fr-mt-2w{ role: 'navigation', 'aria-label': 'Pagination' } %ul.fr-pagination__list = first_page_tag unless current_page.first? = prev_page_tag unless current_page.first? diff --git a/app/views/administrateurs/kaminari/_prev_page.html.haml b/app/views/shared/kaminari/_prev_page.html.haml similarity index 100% rename from app/views/administrateurs/kaminari/_prev_page.html.haml rename to app/views/shared/kaminari/_prev_page.html.haml diff --git a/app/views/users/dossiers/_deleted_dossiers_list.html.haml b/app/views/users/dossiers/_deleted_dossiers_list.html.haml index 23df15f00..b824fba22 100644 --- a/app/views/users/dossiers/_deleted_dossiers_list.html.haml +++ b/app/views/users/dossiers/_deleted_dossiers_list.html.haml @@ -27,7 +27,7 @@ %td = dossier.updated_at.strftime('%d/%m/%Y') - = paginate(deleted_dossiers) + = paginate deleted_dossiers, views_prefix: 'shared' - else .blank-tab diff --git a/app/views/users/dossiers/_dossiers_list.html.haml b/app/views/users/dossiers/_dossiers_list.html.haml index 26ba0d038..b62773984 100644 --- a/app/views/users/dossiers/_dossiers_list.html.haml +++ b/app/views/users/dossiers/_dossiers_list.html.haml @@ -43,7 +43,7 @@ %td.action-col.follow-col = render partial: 'dossier_actions', locals: { dossier: dossier } - = paginate(dossiers) + = paginate dossiers, views_prefix: 'shared' - else .blank-tab diff --git a/app/views/users/dossiers/_hidden_dossiers_list.html.haml b/app/views/users/dossiers/_hidden_dossiers_list.html.haml index 0cf10f3dd..0eaca0601 100644 --- a/app/views/users/dossiers/_hidden_dossiers_list.html.haml +++ b/app/views/users/dossiers/_hidden_dossiers_list.html.haml @@ -31,7 +31,7 @@ = link_to restore_dossier_path(dossier.id), method: :patch, class: "fr-btn" do Restaurer - = paginate(hidden_dossiers) + = paginate hidden_dossiers, views_prefix: 'shared' - else .blank-tab diff --git a/app/views/users/dossiers/_transfered_dossiers_list.html.haml b/app/views/users/dossiers/_transfered_dossiers_list.html.haml index 9774e7253..f3aff1b8e 100644 --- a/app/views/users/dossiers/_transfered_dossiers_list.html.haml +++ b/app/views/users/dossiers/_transfered_dossiers_list.html.haml @@ -28,7 +28,7 @@ %td= status_badge(dossier.state) %td.action-col.follow-col{ style: 'padding: 18px;' }= (dossier.depose_at || dossier.created_at).strftime('%d/%m/%Y') - = paginate(dossier_transfers) + = paginate dossier_transfers, views_prefix: 'shared' - else .blank-tab