demarches-normaliennes/app/views/layouts/_header.haml

80 lines
3.7 KiB
Text
Raw Normal View History

-# We can't use &. because the controller may not implement #nav_bar_profile
- nav_bar_profile = controller.try(:nav_bar_profile) || :guest
- dossier = controller.try(:dossier_for_help)
- procedure = controller.try(:procedure_for_help)
-# only display the coronavirus to usagers (instructeurs know there are delays) when they are logged in, or on the public pages.
- if user_signed_in?
2021-03-03 18:20:34 +01:00
- if dossier.present? && dossier.procedure.feature_enabled?(:coronavirus_banner)
= render partial: 'layouts/coronavirus_banner'
- else
2021-03-03 18:20:34 +01:00
- if procedure.present? && procedure.feature_enabled?(:coronavirus_banner)
= render partial: 'layouts/coronavirus_banner'
2019-11-25 17:16:48 +01:00
%header.new-header{ class: current_page?(root_path) ? nil : "new-header-with-border", role: 'banner' }
2017-04-04 14:37:16 +02:00
.header-inner-content
2017-07-03 16:01:44 +02:00
2020-05-14 14:50:14 +02:00
.flex.align-center.justify-center
- 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
- 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 HEADER_LOGO_SRC, alt: HEADER_LOGO_ALT, width: HEADER_LOGO_WIDTH, height: HEADER_LOGO_HEIGHT, loading: 'lazy'
%span.big.site-title>
= APPLICATION_NAME
%span.small.site-title>
= APPLICATION_SHORTNAME
2017-07-03 16:01:44 +02:00
- if nav_bar_profile == :instructeur && instructeur_signed_in?
2017-09-06 11:13:59 +02:00
- current_url = request.path_info
2017-08-28 10:46:27 +02:00
%ul.header-tabs
- if current_instructeur.procedures.count > 0
2017-09-06 11:13:59 +02:00
%li
= active_link_to "Démarches", instructeur_procedures_path, active: ['dossiers','procedures'].include?(controller_name), class: 'tab-link'
- if current_instructeur.avis.count > 0
2017-09-06 11:13:59 +02:00
%li
2020-07-20 11:26:19 +02:00
= active_link_to instructeur_all_avis_path, active: controller_name == 'avis', class: 'tab-link' do
2017-09-20 15:49:49 +02:00
Avis
- avis_counter = current_instructeur.avis.without_answer.count
2017-09-20 15:49:49 +02:00
- if avis_counter > 0
%span.badge.warning= avis_counter
2017-04-04 14:37:16 +02:00
- if nav_bar_profile == :user
%ul.header-tabs
%li
= active_link_to "Dossiers", dossiers_path, active: :inclusive, class: 'tab-link'
2017-06-22 14:56:59 +02:00
%ul.header-right-content
- if nav_bar_profile == :instructeur && instructeur_signed_in?
2017-06-22 14:56:59 +02:00
%li
= render partial: 'layouts/search_dossiers_form', locals: { search_endpoint: instructeur_recherche_path }
- if nav_bar_profile == :user && user_signed_in? && current_user.dossiers.count > 2
%li
= render partial: 'layouts/search_dossiers_form', locals: { search_endpoint: recherche_dossiers_path }
- if instructeur_signed_in? || user_signed_in?
2017-06-22 16:45:57 +02:00
%li
= render partial: 'layouts/account_dropdown', locals: { nav_bar_profile: nav_bar_profile }
2017-06-26 14:01:54 +02:00
2017-06-22 14:56:59 +02:00
- elsif request.path != new_user_session_path
- if request.path == new_user_registration_path
%li
Vous avez déjà un compte ?
2017-06-22 14:56:59 +02:00
%li
2017-06-26 11:40:28 +02:00
= link_to "Connexion", new_user_session_path, class: "button secondary"
%li
2019-11-19 09:06:55 +01:00
- if dossier.present? && nav_bar_profile == :user
= render partial: 'shared/help/help_dropdown_dossier', locals: { dossier: dossier }
2019-11-19 09:06:55 +01:00
- elsif procedure.present? && (nav_bar_profile == :user || nav_bar_profile == :guest)
= render partial: 'shared/help/help_dropdown_procedure', locals: { procedure: procedure }
2019-11-19 09:06:55 +01:00
- elsif nav_bar_profile == :instructeur
= render partial: 'shared/help/help_dropdown_instructeur'
2019-11-19 09:06:55 +01:00
- else
= render partial: 'shared/help/help_button'