diff --git a/app/views/layouts/_header.haml b/app/views/layouts/_header.haml index 75e2f9b14..2ceaced71 100644 --- a/app/views/layouts/_header.haml +++ b/app/views/layouts/_header.haml @@ -8,83 +8,84 @@ - is_user_context = nav_bar_profile == :user - is_search_enabled = [params[:controller] == 'recherche', is_instructeur_context, is_expert_context, is_user_context && current_user.dossiers.count].any? %header{ class: ["fr-header", content_for?(:notice_info) && "fr-header__with-notice-info"], role: "banner", "data-controller": "dsfr-header" } - .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) + %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 + = 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 + .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" - %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" + - if dossier.present? && nav_bar_profile == :user + = render partial: 'shared/help/help_dropdown_dossier', locals: { dossier: dossier } - %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 } - - elsif procedure.present? && (nav_bar_profile == :user || nav_bar_profile == :guest) - = render partial: 'shared/help/help_dropdown_procedure', locals: { procedure: procedure } - - - elsif nav_bar_profile == :instructeur - = render partial: 'shared/help/help_dropdown_instructeur' - - else - // NB: on mobile in order to have links correctly aligned, we need a left icon - = link_to t('help'), t("links.common.faq.url"), class: 'fr-btn dropdown-button', title: t('help') + - elsif nav_bar_profile == :instructeur + = render partial: 'shared/help/help_dropdown_instructeur' + - else + // NB: on mobile in order to have links correctly aligned, we need a left icon + = link_to t('help'), t("links.common.faq.url"), class: 'fr-btn dropdown-button', title: t('help') - - if localization_enabled? - %li= render partial: 'layouts/locale_dropdown' + - if localization_enabled? + %li= render partial: 'layouts/locale_dropdown' - - if params[:controller] == 'recherche' - = render partial: 'layouts/search_dossiers_form' + - if params[:controller] == 'recherche' + = render partial: 'layouts/search_dossiers_form' - - if is_instructeur_context - = render partial: 'layouts/search_dossiers_form' + - if is_instructeur_context + = render partial: 'layouts/search_dossiers_form' - - if is_expert_context - = render partial: 'layouts/search_dossiers_form' + - if is_expert_context + = render partial: 'layouts/search_dossiers_form' - = render SwitchDomainBannerComponent.new(user: current_user) + = render SwitchDomainBannerComponent.new(user: current_user) - #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 + #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 - - 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' + - 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' - = yield(:notice_info) + = yield(:notice_info) diff --git a/app/views/layouts/_locale_dropdown.html.haml b/app/views/layouts/_locale_dropdown.html.haml index 287df6ec3..dd2387016 100644 --- a/app/views/layouts/_locale_dropdown.html.haml +++ b/app/views/layouts/_locale_dropdown.html.haml @@ -1,4 +1,4 @@ -%nav.fr-translate.fr-nav{ :role => "navigation", title: t('.select_locale') } +.fr-translate.fr-nav .fr-nav__item %button.fr-translate__btn.fr-btn{ "aria-controls" => "translate", "aria-expanded" => "false", :title => t('.select_locale') } = I18n.locale.upcase