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?
|
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" }
|
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
|
2024-04-04 15:51:36 +02:00
|
|
|
%p.fr-logo{ lang: "fr" }
|
2022-08-18 17:06:58 +02:00
|
|
|
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')
|
2024-04-17 16:37:26 +02:00
|
|
|
%button#navbar-burger-button.fr-btn--menu.fr-btn{ "aria-controls" => "modal-header__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)
|
|
|
|
|
2024-03-20 11:34:54 +01:00
|
|
|
= link_to root_profile_link, title: "#{root_profile_libelle} — #{Current.application_name}" do
|
2024-04-04 15:51:36 +02:00
|
|
|
%span.fr-header__service-title{ lang: "fr" }= Current.application_name
|
2022-08-18 17:06:58 +02:00
|
|
|
|
|
|
|
.fr-header__tools
|
2022-08-19 15:58:34 +02:00
|
|
|
.fr-header__tools-links.relative
|
|
|
|
|
2023-12-11 12:25:15 +01:00
|
|
|
%ul.fr-btns-group.flex.align-center
|
2022-08-18 17:06:58 +02:00
|
|
|
- if instructeur_signed_in? || user_signed_in?
|
|
|
|
%li
|
2024-03-01 09:50:39 +01:00
|
|
|
= render partial: 'layouts/account_dropdown', locals: { nav_bar_profile: nav_bar_profile, dossier: dossier }
|
2022-08-18 17:06:58 +02:00
|
|
|
- elsif (request.path != new_user_session_path && request.path !=agent_connect_path)
|
|
|
|
- if request.path == new_user_registration_path
|
2024-04-02 15:44:42 +02:00
|
|
|
%li.fr-hidden-sm.fr-unhidden-lg.fr-link--sm.fr-mb-2w.fr-mr-1v= t('views.shared.account.already_user_question')
|
2023-12-11 12:09:34 +01:00
|
|
|
%li= link_to 'Agent', agent_connect_path, class: "fr-btn fr-btn--tertiary fr-icon-government-fill fr-btn--icon-left"
|
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
|
2024-04-24 15:50:42 +02:00
|
|
|
= link_to t('help'), t("links.common.faq.url"), class: 'fr-btn dropdown-button', title: t('help')
|
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'
|
2023-04-14 16:24:50 +02:00
|
|
|
= render partial: 'layouts/search_dossiers_form'
|
2022-08-18 17:06:58 +02:00
|
|
|
|
|
|
|
- if is_instructeur_context
|
2023-04-14 16:24:50 +02:00
|
|
|
= render partial: 'layouts/search_dossiers_form'
|
2022-08-18 17:06:58 +02:00
|
|
|
|
|
|
|
- if is_expert_context
|
2023-04-14 16:24:50 +02:00
|
|
|
= render partial: 'layouts/search_dossiers_form'
|
2022-08-18 17:06:58 +02:00
|
|
|
|
2024-02-23 14:05:12 +01:00
|
|
|
= render SwitchDomainBannerComponent.new(user: current_user)
|
|
|
|
|
2023-10-30 15:37:04 +01:00
|
|
|
#modal-header__menu.fr-header__menu.fr-modal{ "aria-labelledby": "navbar-burger-button" }
|
2022-08-31 12:44:00 +02:00
|
|
|
.fr-container
|
2023-10-30 15:37:04 +01:00
|
|
|
%button.fr-btn--close.fr-btn{ "aria-controls" => "modal-header__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
|
2023-10-30 15:37:04 +01:00
|
|
|
-# populated by dsfr js
|
2022-08-31 12:44:00 +02:00
|
|
|
|
2023-10-30 15:37:04 +01: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
|
|
|
|
2022-09-19 16:13:41 +02:00
|
|
|
= yield(:notice_info)
|