include the libelle with the redirection link

This commit is contained in:
clemkeirua 2020-06-03 14:55:36 +02:00 committed by Keirua (Rebase PR Action)
parent efe7773eb5
commit abe0e321ac
2 changed files with 16 additions and 2 deletions

View file

@ -122,6 +122,19 @@ module ApplicationHelper
end end
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) def try_format_date(date)
date.present? ? I18n.l(date) : '' date.present? ? I18n.l(date) : ''
end end

View file

@ -18,9 +18,10 @@
- if params[:controller] == 'users/commencer' - if params[:controller] == 'users/commencer'
= link_to 'Revenir en arrière', url_for(:back), class: "button", title: "Revenir sur le site de mon administration" = link_to 'Revenir en arrière', url_for(:back), class: "button", title: "Revenir sur le site de mon administration"
- else - 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' = 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.big.site-title> demarches-simplifiees.fr
%span.small.site-title> d-s.fr %span.small.site-title> d-s.fr