From 35a17cc2c6f1ae968f0a651dd0f8d9b16691091d Mon Sep 17 00:00:00 2001 From: Colin Darie Date: Tue, 5 Nov 2024 18:23:14 +0100 Subject: [PATCH] refactor(dsfr): all procedures table to v1.12 --- app/assets/stylesheets/dsfr.scss | 5 + .../procedures/_detail.html.haml | 15 ++- .../administrateurs/procedures/all.html.haml | 112 ++++++++++-------- 3 files changed, 72 insertions(+), 60 deletions(-) diff --git a/app/assets/stylesheets/dsfr.scss b/app/assets/stylesheets/dsfr.scss index 6478ea3c7..a3cec9d0e 100644 --- a/app/assets/stylesheets/dsfr.scss +++ b/app/assets/stylesheets/dsfr.scss @@ -266,6 +266,11 @@ button.fr-tag-bug { white-space: nowrap; } +// Caption is bold, but all-procedures table use fr-tag in caption +.fr-table caption .fr-tag { + font-weight: normal; +} + // We remove the line height because it creates unharmonized spaces - most of all in table .fr-tags-group > li { line-height: inherit; diff --git a/app/views/administrateurs/procedures/_detail.html.haml b/app/views/administrateurs/procedures/_detail.html.haml index 99b8b1410..a2855bbf9 100644 --- a/app/views/administrateurs/procedures/_detail.html.haml +++ b/app/views/administrateurs/procedures/_detail.html.haml @@ -1,9 +1,9 @@ %tr.procedure{ id: "procedure_#{procedure.id}" } - %td + %th.fr-cell--fixed{ scope: 'row' } - title = show_detail ? 'Cacher les détails de la démarche' : 'Afficher les détails de la démarche' - icon = show_detail ? 'fr-icon-subtract-line' : 'fr-icon-add-line' - params = show_detail ? {} : { show_detail: true } - = button_to detail_admin_procedure_path(procedure["id"]), method: :post, params:, title:, class: [icon, "fr-icon--sm fr-mr-1w fr-mb-1w fr-text-action-high--blue-france fr-btn fr-btn--tertiary-no-outline" ] do + = button_to detail_admin_procedure_path(procedure["id"]), method: :post, params:, title:, class: [icon, "fr-icon--sm fr-mb-1w fr-text-action-high--blue-france fr-btn fr-btn--tertiary-no-outline" ] do = title %td - if procedure.template @@ -11,7 +11,7 @@ %abbr{ title: APPLICATION_NAME }= acronymize(APPLICATION_NAME) = procedure.libelle %td= procedure.id - %td= procedure.estimated_dossiers_count + %td.fr-cell--right= procedure.estimated_dossiers_count %td - if procedure.respond_to?(:parsed_latest_zone_labels) - procedure.parsed_latest_zone_labels.uniq.each do |zone_label| @@ -31,8 +31,7 @@ - if show_detail %tr.procedure{ id: "procedure_detail_#{procedure.id}" } - %td.fr-highlight--green-emeraude{ colspan: '8' } - .fr-container - .fr-col-6 - - procedure.administrateurs.uniq.each do |admin| - = admin.email + %td.fr-background-alt--green-emeraude{ colspan: '8' } + %ul + - procedure.administrateurs.uniq.each do |admin| + %li= admin.email diff --git a/app/views/administrateurs/procedures/all.html.haml b/app/views/administrateurs/procedures/all.html.haml index 224e59fc6..1b4c21f80 100644 --- a/app/views/administrateurs/procedures/all.html.haml +++ b/app/views/administrateurs/procedures/all.html.haml @@ -14,55 +14,63 @@ .actions .link.fr-mx-1w= link_to 'Voir les administrateurs', administrateurs_admin_procedures_path(@filter.params), class: 'fr-btn fr-btn--secondary' .link.fr-mx-1w{ "data-turbo": "false" }= link_to 'Exporter les résultats', all_admin_procedures_path(@filter.params.merge(format: :xlsx)), class: 'fr-btn fr-btn--secondary' - .fr-table.fr-table--bordered - %table#all-demarches - %caption - = "#{@procedures.total_count} #{t('pluralize.procedures', count: @procedures.total_count)}" - %span.hidden.spinner{ 'aria-hidden': 'true', 'data-turbo-target': 'spinner' } - - if @filter.libelle - .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' - - if @filter.service_siret - .selected-query.fr-mb-2w - = link_to @filter.service_siret, all_admin_procedures_path(@filter.without(:service_siret)), class: 'fr-tag fr-tag--dismiss fr-mb-1w' - - if @filter.service_departement - .selected-query.fr-mb-2w - = link_to "#{@filter.service_departement} – #{APIGeoService.departement_name(@filter.service_departement)}", all_admin_procedures_path(@filter.without(:service_departement)), class: 'fr-tag fr-tag--dismiss fr-mb-1w' - - if @filter.selected_zones.present? - .selected-zones.fr-mb-2w - - @filter.selected_zones.each do |zone| - = link_to zone.current_label, all_admin_procedures_path(@filter.without(:zone_ids, zone.id)), class: 'fr-tag fr-tag--dismiss fr-mb-1w' - - if @filter.statuses.present? - .selected-statuses.fr-mb-2w - - @filter.statuses.each do |status| - = link_to status, all_admin_procedures_path(@filter.without(:statuses, status)), class: 'fr-tag fr-tag--dismiss fr-mb-1w' - - if @filter.kind_usagers.present? - .selected-kind_usagers.fr-mb-2w - - @filter.kind_usagers.each do |kind_usager| - = link_to t(kind_usager, scope: 'activerecord.attributes.procedure.kind_usager'), all_admin_procedures_path(@filter.without(:kind_usagers, kind_usager)), class: 'fr-tag fr-tag--dismiss fr-mb-1w' - - if @filter.tags.present? - .selected-tag.fr-mb-2w - - @filter.tags.each do |tag| - = link_to tag, all_admin_procedures_path(@filter.without(:tags, tag)), class: 'fr-tag fr-tag--dismiss fr-mb-1w' - - params[:tags].delete(tag) - - if @filter.template? - .selected-template.fr-mb-2w - = link_to "Modèle DS", all_admin_procedures_path(@filter.without(:template)), class: 'fr-tag fr-tag--dismiss fr-mb-1w' - - 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: 'shared' - %thead - %tr - %th{ scope: 'col' } - %th{ scope: 'col' } Démarche - %th{ scope: 'col' } № - %th{ scope: 'col' } Nombre de dossiers - %th{ scope: 'col' } Zones - %th{ scope: 'col' } Statut - %th{ scope: 'col' } Date - %th{ scope: 'col' } Action - %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: 'shared' + + .fr-table.fr-table--sm.fr-table--no-scroll.fr-table--bordered + .fr-table__wrapper + .fr-table__container + .fr-table__content + %table + %caption + = "#{@procedures.total_count} #{t('pluralize.procedures', count: @procedures.total_count)}" + %span.hidden.spinner{ 'aria-hidden': 'true', 'data-turbo-target': 'spinner' } + - if @filter.libelle + .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' + - if @filter.service_siret + .selected-query.fr-mb-2w + = link_to @filter.service_siret, all_admin_procedures_path(@filter.without(:service_siret)), class: 'fr-tag fr-tag--dismiss fr-mb-1w' + - if @filter.service_departement + .selected-query.fr-mb-2w + = link_to "#{@filter.service_departement} – #{APIGeoService.departement_name(@filter.service_departement)}", all_admin_procedures_path(@filter.without(:service_departement)), class: 'fr-tag fr-tag--dismiss fr-mb-1w' + - if @filter.selected_zones.present? + .selected-zones.fr-mb-2w + - @filter.selected_zones.each do |zone| + = link_to zone.current_label, all_admin_procedures_path(@filter.without(:zone_ids, zone.id)), class: 'fr-tag fr-tag--dismiss fr-mb-1w' + - if @filter.statuses.present? + .selected-statuses.fr-mb-2w + - @filter.statuses.each do |status| + = link_to status, all_admin_procedures_path(@filter.without(:statuses, status)), class: 'fr-tag fr-tag--dismiss fr-mb-1w' + - if @filter.kind_usagers.present? + .selected-kind_usagers.fr-mb-2w + - @filter.kind_usagers.each do |kind_usager| + = link_to t(kind_usager, scope: 'activerecord.attributes.procedure.kind_usager'), all_admin_procedures_path(@filter.without(:kind_usagers, kind_usager)), class: 'fr-tag fr-tag--dismiss fr-mb-1w' + - if @filter.tags.present? + .selected-tag.fr-mb-2w + - @filter.tags.each do |tag| + = link_to tag, all_admin_procedures_path(@filter.without(:tags, tag)), class: 'fr-tag fr-tag--dismiss fr-mb-1w' + - params[:tags].delete(tag) + - if @filter.template? + .selected-template.fr-mb-2w + = link_to "Modèle DS", all_admin_procedures_path(@filter.without(:template)), class: 'fr-tag fr-tag--dismiss fr-mb-1w' + - 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' + + %thead + %tr + %th{ role: 'columnheader' } + %th{ scope: 'col' } Démarche + %th{ scope: 'col' } № + %th{ scope: 'col' } Nombre de dossiers + %th{ scope: 'col' } Zones + %th{ scope: 'col' } Statut + %th{ scope: 'col' } Date + %th{ scope: 'col' } Action + %tbody{ 'data-turbo': 'true' } + - @procedures.each do |procedure| + = render partial: 'detail', locals: { procedure: procedure, show_detail: false } + .fr-table__footer + .fr-table__footer--start + .fr-table__footer--middle + = paginate @procedures, params: @filter.params, views_prefix: 'shared' + .fr-table__footer--end.flex-no-grow