From abe0e321ac733e80698f4a6539fcb7fd12620dbf Mon Sep 17 00:00:00 2001 From: clemkeirua Date: Wed, 3 Jun 2020 14:55:36 +0200 Subject: [PATCH] include the libelle with the redirection link --- app/helpers/application_helper.rb | 13 +++++++++++++ app/views/layouts/_new_header.haml | 5 +++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index e7f399a48..68000c339 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -122,6 +122,19 @@ module ApplicationHelper end end + def root_path_info_for_profile(nav_bar_profile) + case nav_bar_profile + when :administrateur + [admin_procedures_path, "Aller au panneau d'administration"] + when :instructeur + [instructeur_procedures_path, 'Aller à la liste des démarches'] + when :user + [dossiers_path, 'Aller à la liste des dossiers'] + else + [root_path, "Aller à la page d'accueil"] + end + end + def try_format_date(date) date.present? ? I18n.l(date) : '' end diff --git a/app/views/layouts/_new_header.haml b/app/views/layouts/_new_header.haml index 7967eca97..f7aab0319 100644 --- a/app/views/layouts/_new_header.haml +++ b/app/views/layouts/_new_header.haml @@ -18,9 +18,10 @@ - if params[:controller] == 'users/commencer' = link_to 'Revenir en arrière', url_for(:back), class: "button", title: "Revenir sur le site de mon administration" - else - = link_to root_path_for_profile(nav_bar_profile), class: 'header-logo justify-center', title: "Aller à la page d'accueil de demarches-simplifiees.fr" do + - root_profile_link, root_profile_libelle = root_path_info_for_profile(nav_bar_profile) + = link_to root_profile_link, class: 'header-logo justify-center', title: root_profile_libelle do = image_tag 'marianne.svg', alt: 'Liberté, égalité, fraternité', width: '65px' - = link_to root_path_for_profile(nav_bar_profile), class: 'header-logo justify-center', title: "Aller à la page d'accueil de demarches-simplifiees.fr" do + = link_to root_profile_link, class: 'header-logo justify-center', title: root_profile_libelle do %span.big.site-title> demarches-simplifiees.fr %span.small.site-title> d-s.fr