2019-03-13 16:48:38 +01:00
|
|
|
-# We can't use &. because the controller may not implement #nav_bar_profile
|
2019-03-28 11:14:01 +01:00
|
|
|
- nav_bar_profile = controller.try(:nav_bar_profile) || :guest
|
2019-03-13 16:48:38 +01:00
|
|
|
- dossier = controller.try(:dossier_for_help)
|
2019-03-28 11:14:01 +01:00
|
|
|
- procedure = controller.try(:procedure_for_help)
|
2022-08-18 17:06:58 +02:00
|
|
|
- is_instructeur_context = nav_bar_profile == :instructeur && instructeur_signed_in?
|
|
|
|
- is_expert_context = nav_bar_profile == :expert && expert_signed_in?
|
|
|
|
- is_user_context = nav_bar_profile == :user
|
2022-08-19 15:58:34 +02:00
|
|
|
- is_search_enabled = [params[:controller] == 'recherche', is_instructeur_context, is_expert_context, is_user_context && current_user.dossiers.count].any?
|
2022-09-19 16:13:41 +02:00
|
|
|
%header{ class: ["fr-header", content_for?(:notice_info) && "fr-header__with-notice-info"], role: "banner", "data-controller": "dsfr-header" }
|
2022-08-18 17:06:58 +02:00
|
|
|
.fr-header__body
|
|
|
|
.fr-container
|
|
|
|
.fr-header__body-row
|
|
|
|
.fr-header__brand.fr-enlarge-link
|
|
|
|
.fr-header__brand-top
|
|
|
|
.fr-header__logo
|
|
|
|
%p.fr-logo
|
|
|
|
République
|
|
|
|
= succeed "Française" do
|
|
|
|
%br/
|
|
|
|
.fr-header__navbar
|
|
|
|
- if is_search_enabled
|
|
|
|
%button.fr-btn--search.fr-btn{ "aria-controls" => "search-modal", "data-fr-opened" => "false", :title => t('views.users.dossiers.search.search_file') }= t('views.users.dossiers.search.search_file')
|
2022-09-02 10:12:09 +02:00
|
|
|
%button.fr-btn--menu.fr-btn{ "aria-controls" => "burger-menu", "aria-haspopup" => "menu", "data-fr-opened" => "false", :title => "Menu" } Menu
|
2022-08-18 17:06:58 +02:00
|
|
|
.fr-header__service
|
|
|
|
- root_profile_link, root_profile_libelle = root_path_info_for_profile(nav_bar_profile)
|
|
|
|
|
2022-11-28 14:50:41 +01:00
|
|
|
= link_to root_profile_link, title: "#{root_profile_libelle} — #{APPLICATION_NAME}" do
|
2022-08-18 17:06:58 +02:00
|
|
|
%p.fr-header__service-title= APPLICATION_NAME
|
|
|
|
|
|
|
|
.fr-header__tools
|
2022-08-19 15:58:34 +02:00
|
|
|
.fr-header__tools-links.relative
|
|
|
|
|
2022-08-18 17:06:58 +02:00
|
|
|
%ul.fr-btns-group
|
|
|
|
- if instructeur_signed_in? || user_signed_in?
|
|
|
|
%li
|
|
|
|
= render partial: 'layouts/account_dropdown', locals: { nav_bar_profile: nav_bar_profile }
|
|
|
|
- elsif (request.path != new_user_session_path && request.path !=agent_connect_path)
|
|
|
|
- if request.path == new_user_registration_path
|
|
|
|
%li
|
|
|
|
.fr-hidden-sm.fr-unhidden-lg.fr-link--sm= t('views.shared.account.already_user_question')
|
2022-10-05 16:38:49 +02:00
|
|
|
%li= link_to t('views.shared.account.signin'), new_user_session_path, class: "fr-btn fr-btn--tertiary fr-icon-account-circle-fill fr-btn--icon-left"
|
2022-08-18 17:06:58 +02:00
|
|
|
|
2022-08-22 10:43:11 +02:00
|
|
|
%li
|
|
|
|
- if dossier.present? && nav_bar_profile == :user
|
|
|
|
= render partial: 'shared/help/help_dropdown_dossier', locals: { dossier: dossier }
|
|
|
|
|
|
|
|
- elsif procedure.present? && (nav_bar_profile == :user || nav_bar_profile == :guest)
|
|
|
|
= render partial: 'shared/help/help_dropdown_procedure', locals: { procedure: procedure }
|
2022-08-18 17:06:58 +02:00
|
|
|
|
2022-08-22 10:43:11 +02:00
|
|
|
- elsif nav_bar_profile == :instructeur
|
|
|
|
= render partial: 'shared/help/help_dropdown_instructeur'
|
|
|
|
- else
|
2022-11-30 09:56:32 +01:00
|
|
|
// NB: on mobile in order to have links correctly aligned, we need a left icon
|
2023-01-09 16:58:19 +01:00
|
|
|
= link_to t('help'), t("links.common.faq.url"), class: 'fr-btn fr-icon-questionnaire-line fr-btn--icon-left', title: new_tab_suffix(t('help')), **external_link_attributes
|
2022-08-18 17:06:58 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
2022-08-22 10:43:11 +02:00
|
|
|
- if localization_enabled?
|
|
|
|
%li= render partial: 'layouts/locale_dropdown'
|
2022-08-19 15:58:34 +02:00
|
|
|
|
2022-08-18 17:06:58 +02:00
|
|
|
|
|
|
|
- if params[:controller] == 'recherche'
|
|
|
|
= render partial: 'layouts/search_dossiers_form', locals: { search_endpoint: recherche_index_path }
|
|
|
|
|
|
|
|
- if is_instructeur_context
|
|
|
|
= render partial: 'layouts/search_dossiers_form', locals: { search_endpoint: recherche_index_path }
|
|
|
|
|
|
|
|
- if is_expert_context
|
|
|
|
= render partial: 'layouts/search_dossiers_form', locals: { search_endpoint: recherche_index_path }
|
|
|
|
|
|
|
|
- if is_user_context && current_user.dossiers.count > 2
|
|
|
|
= render partial: 'layouts/search_dossiers_form', locals: { search_endpoint: recherche_dossiers_path }
|
|
|
|
|
|
|
|
- has_header = [is_instructeur_context, is_expert_context, is_user_context]
|
2022-09-02 10:12:09 +02:00
|
|
|
#burger-menu.fr-header__menu.fr-modal{ "aria-labelledby" => "burger_button" }
|
2022-08-31 12:44:00 +02:00
|
|
|
.fr-container
|
2022-09-02 10:12:09 +02:00
|
|
|
%button#burger_button.fr-btn--close.fr-btn{ "aria-controls" => "burger-menu", :title => t('close_modal', scope: [:layouts, :header]) }= t('close_modal', scope: [:layouts, :header])
|
2022-08-31 12:44:00 +02:00
|
|
|
.fr-header__menu-links
|
2022-09-02 10:12:09 +02:00
|
|
|
%nav#navigation-478.fr-nav{ "aria-label" => t('main_menu', scope: [:layouts, :header]) , :role => "navigation" }
|
2022-08-31 12:44:00 +02:00
|
|
|
%ul.fr-nav__list
|
|
|
|
-# Questionner UX pour un back JS
|
|
|
|
- if params[:controller] == 'users/commencer'
|
|
|
|
%li.fr-nav__item
|
2022-09-02 10:12:09 +02:00
|
|
|
= link_to t('back', scope: [:layouts, :header]), url_for(:back), title: t('back_title', scope: [:layouts, :header]), class: 'fr-nav__link'
|
2022-08-31 12:44:00 +02:00
|
|
|
|
2022-08-18 17:06:58 +02:00
|
|
|
- if is_instructeur_context
|
|
|
|
- if current_instructeur.procedures.any?
|
|
|
|
- current_url = request.path_info
|
|
|
|
%li.fr-nav__item
|
2022-08-19 15:58:34 +02:00
|
|
|
= active_link_to t('utils.procedure'), instructeur_procedures_path, active: ['dossiers','procedures'].include?(controller_name), class: 'fr-nav__link'
|
|
|
|
- if current_instructeur.user.expert && current_expert.avis_summary[:total] > 0
|
|
|
|
= render partial: 'layouts/header/avis_tab', locals: { current_expert: current_expert }
|
|
|
|
|
|
|
|
- if is_expert_context
|
|
|
|
- if current_expert.user.instructeur && current_instructeur.procedures.any?
|
|
|
|
%li.fr-nav__item= active_link_to t('utils.procedure'), instructeur_procedures_path, active: ['dossiers','procedures'].include?(controller_name), class: 'fr-nav__link'
|
|
|
|
- if current_expert.avis_summary[:total] > 0
|
|
|
|
= render partial: 'layouts/header/avis_tab', locals: { current_expert: current_expert }
|
|
|
|
|
|
|
|
- if is_user_context
|
|
|
|
%li.fr-nav__item= active_link_to t('.files'), dossiers_path, active: :inclusive, class: 'fr-nav__link'
|
|
|
|
- if current_user.expert && current_expert.avis_summary[:total] > 0
|
|
|
|
= render partial: 'layouts/header/avis_tab', locals: { current_expert: current_expert }
|
2022-09-14 16:19:14 +02:00
|
|
|
|
2022-09-19 16:13:41 +02:00
|
|
|
= yield(:notice_info)
|
2022-09-14 16:19:14 +02:00
|
|
|
|