2024-09-11 12:09:21 +02:00
|
|
|
-# We can't use &. or as helper methods because the controllers from view specs does not implement these methods
|
|
|
|
- nav_bar_profile = controller.try(:nav_bar_profile) || controller.try(:fallback_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?
|
2023-10-30 15:37:04 +01:00
|
|
|
- is_administrateur_context = nav_bar_profile == :administrateur && administrateur_signed_in?
|
2022-08-18 17:06:58 +02:00
|
|
|
- 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" }
|
2024-06-17 14:46:49 +02:00
|
|
|
%nav{ :role => "navigation", "aria-label" => t('layouts.header.main_menu') }
|
|
|
|
.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{ lang: "fr" }
|
|
|
|
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')
|
|
|
|
%button#navbar-burger-button.fr-btn--menu.fr-btn{ "aria-controls" => "modal-header__menu", "data-fr-opened" => "false", title: "Menu" } Menu
|
|
|
|
.fr-header__service
|
|
|
|
- root_profile_link, root_profile_libelle = root_path_info_for_profile(nav_bar_profile)
|
|
|
|
|
|
|
|
= link_to root_profile_link, title: "#{root_profile_libelle} — #{Current.application_name}" do
|
|
|
|
%span.fr-header__service-title{ lang: "fr" }= Current.application_name
|
|
|
|
|
|
|
|
.fr-header__tools
|
|
|
|
.fr-header__tools-links.relative
|
|
|
|
|
|
|
|
%ul.fr-btns-group.flex.align-center
|
|
|
|
- if instructeur_signed_in? || user_signed_in?
|
|
|
|
%li
|
|
|
|
= render partial: 'layouts/account_dropdown', locals: { nav_bar_profile: nav_bar_profile, dossier: dossier }
|
|
|
|
- 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.fr-mb-2w.fr-mr-1v= t('views.shared.account.already_user_question')
|
|
|
|
%li= link_to 'Agent', agent_connect_path, class: "fr-btn fr-btn--tertiary fr-icon-government-fill fr-btn--icon-left"
|
|
|
|
%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
|
|
|
|
2024-06-17 14:46:49 +02:00
|
|
|
%li
|
|
|
|
- if dossier.present? && nav_bar_profile == :user
|
|
|
|
= render partial: 'shared/help/help_dropdown_dossier', locals: { dossier: dossier }
|
2022-08-22 10:43:11 +02:00
|
|
|
|
2024-06-17 14:46:49 +02:00
|
|
|
- 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
|
|
|
|
2024-06-17 14:46:49 +02:00
|
|
|
- elsif nav_bar_profile == :instructeur
|
|
|
|
= render partial: 'shared/help/help_dropdown_instructeur'
|
|
|
|
- else
|
2024-09-19 11:24:42 +02:00
|
|
|
-# NB: on mobile in order to have links correctly aligned, we need a left icon #
|
2024-06-18 14:39:08 +02:00
|
|
|
= link_to t('help'), t("links.common.faq.url"), class: 'fr-btn dropdown-button'
|
2022-08-18 17:06:58 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
2024-06-17 14:46:49 +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
|
|
|
|
2024-06-17 14:46:49 +02:00
|
|
|
- if is_instructeur_context
|
2024-09-11 15:13:16 +02:00
|
|
|
= render partial: 'layouts/search_dossiers_form', locals: { context: :instructeur }
|
|
|
|
|
|
|
|
- elsif is_expert_context
|
|
|
|
= render partial: 'layouts/search_dossiers_form', locals: { context: :expert }
|
2022-08-18 17:06:58 +02:00
|
|
|
|
2024-09-11 15:13:16 +02:00
|
|
|
- elsif params[:controller] == 'recherche'
|
2024-06-17 14:46:49 +02:00
|
|
|
= render partial: 'layouts/search_dossiers_form'
|
2022-08-18 17:06:58 +02:00
|
|
|
|
2024-06-17 14:46:49 +02:00
|
|
|
= render SwitchDomainBannerComponent.new(user: current_user)
|
2024-02-23 14:05:12 +01:00
|
|
|
|
2024-06-17 14:46:49 +02:00
|
|
|
#modal-header__menu.fr-header__menu.fr-modal{ "aria-labelledby": "navbar-burger-button" }
|
|
|
|
.fr-container
|
|
|
|
%button.fr-btn--close.fr-btn{ "aria-controls" => "modal-header__menu", title: t('close_modal', scope: [:layouts, :header]) }= t('close_modal', scope: [:layouts, :header])
|
|
|
|
.fr-header__menu-links
|
|
|
|
-# populated by dsfr js
|
2022-08-31 12:44:00 +02:00
|
|
|
|
2024-06-17 14:46:49 +02:00
|
|
|
- if content_for?(:main_navigation)
|
|
|
|
= yield(:main_navigation)
|
|
|
|
- elsif is_administrateur_context
|
|
|
|
= render 'administrateurs/main_navigation'
|
|
|
|
- elsif is_instructeur_context || is_expert_context
|
|
|
|
= render MainNavigation::InstructeurExpertNavigationComponent.new
|
|
|
|
- elsif is_user_context
|
|
|
|
= render 'users/main_navigation'
|
2022-08-19 15:58:34 +02:00
|
|
|
|
2023-10-30 15:37:04 +01:00
|
|
|
|
2024-06-17 14:46:49 +02:00
|
|
|
= yield(:notice_info)
|