From 066a2bea854623c3cb8108ea4d2bcea041f63d5c Mon Sep 17 00:00:00 2001 From: Lisa Durand Date: Mon, 22 Jul 2024 15:02:55 +0200 Subject: [PATCH] use main navigation to display deleted dossier for user --- app/controllers/users/dossiers_controller.rb | 2 -- app/views/users/_main_navigation.html.haml | 6 +++++- app/views/users/dossiers/deleted_dossiers.html.haml | 2 -- app/views/users/dossiers/index.html.haml | 6 +----- 4 files changed, 6 insertions(+), 10 deletions(-) diff --git a/app/controllers/users/dossiers_controller.rb b/app/controllers/users/dossiers_controller.rb index 5cd5823d1..9ff659759 100644 --- a/app/controllers/users/dossiers_controller.rb +++ b/app/controllers/users/dossiers_controller.rb @@ -26,7 +26,6 @@ module Users def index ordered_dossiers = Dossier.includes(:procedure).order_by_updated_at - @dossiers_supprimes_historique = current_user.deleted_dossiers.includes(:procedure).order_by_updated_at user_revisions = ProcedureRevision.where(dossiers: current_user.dossiers.visible_by_user) invite_revisions = ProcedureRevision.where(dossiers: current_user.dossiers_invites.visible_by_user) @@ -56,7 +55,6 @@ module Users @dossiers_supprimes = (current_user.dossiers.hidden_by_user.or(current_user.dossiers.hidden_by_expired)).merge(ordered_dossiers) @dossier_transferes = @dossiers_visibles.where(dossier_transfer_id: DossierTransfer.for_email(current_user.email)) @dossiers_close_to_expiration = current_user.dossiers.close_to_expiration.merge(@dossiers_visibles) - @dossiers_supprimes_historique = deleted_dossiers @statut = statut(@user_dossiers, @dossiers_traites, @dossiers_invites, @dossiers_supprimes, @dossier_transferes, @dossiers_close_to_expiration, params[:statut]) diff --git a/app/views/users/_main_navigation.html.haml b/app/views/users/_main_navigation.html.haml index 42aeb669b..ff77a42d0 100644 --- a/app/views/users/_main_navigation.html.haml +++ b/app/views/users/_main_navigation.html.haml @@ -5,4 +5,8 @@ = link_to t('back', scope: [:layouts, :header]), url_for(:back), title: t('back_title', scope: [:layouts, :header]), class: 'fr-nav__link', "aria-controls" => "modal-header__menu" %li.fr-nav__item - = link_to t('files', scope: [:layouts, :header]), dossiers_path, class: 'fr-nav__link', aria: { current: controller_name == 'dossiers' ? 'true' : nil, controls: "modal-header__menu" } + = link_to t('files', scope: [:layouts, :header]), dossiers_path, class: 'fr-nav__link', aria: { current: (controller_name == 'dossiers' && action_name != 'deleted_dossiers') ? 'true' : nil, controls: "modal-header__menu" } + + - if current_user.deleted_dossiers.present? + %li.fr-nav__item + = link_to 'Historique des dossiers supprimés', deleted_dossiers_path(), class: 'fr-nav__link', aria: { current: action_name == 'deleted_dossiers' ? 'true' : nil, controls: "modal-header__menu" } diff --git a/app/views/users/dossiers/deleted_dossiers.html.haml b/app/views/users/dossiers/deleted_dossiers.html.haml index 9d30962cf..77dc10568 100644 --- a/app/views/users/dossiers/deleted_dossiers.html.haml +++ b/app/views/users/dossiers/deleted_dossiers.html.haml @@ -5,8 +5,6 @@ .fr-container - .fr-mb-3w - = link_to "Retour à la liste des dossiers", dossiers_path(), class: "fr-link fr-icon-arrow-left-line fr-link--icon-left" %h1.fr-h2 Historique des dossiers supprimés diff --git a/app/views/users/dossiers/index.html.haml b/app/views/users/dossiers/index.html.haml index b2ce5dcb9..fe0090150 100644 --- a/app/views/users/dossiers/index.html.haml +++ b/app/views/users/dossiers/index.html.haml @@ -5,11 +5,7 @@ .dossiers-headers.sub-header .fr-container - .flex.align-center - %h1.page-title.fr-h2= t('views.users.dossiers.index.dossiers') - - if @dossiers_supprimes_historique.present? - %p.ml-auto - = link_to('Historique des dossiers supprimés', deleted_dossiers_path(), class: 'fr-link') + %h1.page-title.fr-h2= t('views.users.dossiers.index.dossiers') .fr-grid-row.fr-grid-row--gutters - if current_user.dossiers.count > 2 || current_user.dossiers_invites.count > 2