94 lines
4.4 KiB
Text
94 lines
4.4 KiB
Text
/ We can't use &. because the controller may not implement #nav_bar_profile
|
||
- nav_bar_profile = controller.try(:nav_bar_profile)
|
||
|
||
.new-header{ class: current_page?(root_path) ? nil : "new-header-with-border" }
|
||
.header-inner-content
|
||
|
||
.flex.align-center
|
||
= link_to root_path_for_profile(nav_bar_profile), class: "header-logo" do
|
||
= image_tag "header/logo-ds.svg", alt: "demarches-simplifiees.fr", class: "header-logo-wide"
|
||
= image_tag "header/logo-ds-narrow.svg", alt: "demarches-simplifiees.fr", class: "header-logo-narrow"
|
||
|
||
- if nav_bar_profile == :gestionnaire && gestionnaire_signed_in?
|
||
- current_url = request.path_info
|
||
%ul.header-tabs
|
||
- if current_gestionnaire.visible_procedures.count > 0
|
||
%li
|
||
= active_link_to "Démarches", gestionnaire_procedures_path, active: :inclusive, class: 'tab-link'
|
||
- if current_gestionnaire.avis.count > 0
|
||
%li
|
||
= active_link_to gestionnaire_avis_index_path, active: :inclusive, class: 'tab-link' do
|
||
Avis
|
||
- avis_counter = current_gestionnaire.avis.without_answer.count
|
||
- if avis_counter > 0
|
||
%span.badge.warning= avis_counter
|
||
%li
|
||
.tab-link.contact-link
|
||
Aide
|
||
.contact-details
|
||
Besoin d’aide technique ? Contactez-nous
|
||
= contact_link("par email")
|
||
|
||
- if nav_bar_profile == :user
|
||
%ul.header-tabs
|
||
%li
|
||
= active_link_to "Dossiers", dossiers_path, active: :inclusive, class: 'tab-link'
|
||
|
||
%ul.header-right-content
|
||
- if nav_bar_profile == :gestionnaire && gestionnaire_signed_in?
|
||
%li
|
||
.header-search
|
||
= form_tag gestionnaire_recherche_path, method: :get, class: "form" do
|
||
= text_field_tag "q", "#{@search_terms if @search_terms.present?}", placeholder: "Rechercher un dossier"
|
||
%button{ title: "Rechercher" }
|
||
= image_tag "icons/search-blue.svg"
|
||
|
||
- if nav_bar_profile == :user && user_signed_in? && current_user.dossiers.count > 2
|
||
%li
|
||
.header-search
|
||
= form_tag recherche_dossiers_path, method: :post, class: "form" do
|
||
= text_field_tag :dossier_id, "", placeholder: "Numéro de dossier"
|
||
%button{ title: "Rechercher" }
|
||
= image_tag "icons/search-blue.svg"
|
||
|
||
- if gestionnaire_signed_in? || user_signed_in?
|
||
%li
|
||
%span.dropdown.header-menu-opener
|
||
%button.button.dropdown-button.header-menu-button
|
||
= image_tag "icons/account-circle.svg", title: "Mon compte"
|
||
%ul.header-menu.dropdown-content
|
||
%li
|
||
.menu-item{ title: current_email }
|
||
= current_email
|
||
- if administration_signed_in?
|
||
%li
|
||
= link_to manager_root_path, class: "menu-item menu-link" do
|
||
= image_tag "icons/super-admin.svg"
|
||
Passer en super-admin
|
||
- if SwitchDeviseProfileService.new(warden).multiple_devise_profile_connect?
|
||
- if user_signed_in? && nav_bar_profile != :user
|
||
%li
|
||
= link_to dossiers_path, class: "menu-item menu-link" do
|
||
= image_tag "icons/switch-profile.svg"
|
||
Passer en usager
|
||
- if gestionnaire_signed_in? && nav_bar_profile != :gestionnaire
|
||
%li
|
||
= link_to gestionnaire_procedures_path, class: "menu-item menu-link" do
|
||
= image_tag "icons/switch-profile.svg"
|
||
Passer en instructeur
|
||
- if administrateur_signed_in? && nav_bar_profile != :administrateur
|
||
%li
|
||
= link_to admin_procedures_path, class: "menu-item menu-link" do
|
||
= image_tag "icons/switch-profile.svg"
|
||
Passer en administrateur
|
||
|
||
%li
|
||
= link_to destroy_user_session_path, method: :delete, class: "menu-item menu-link" do
|
||
= image_tag "icons/sign-out.svg"
|
||
Se déconnecter
|
||
- elsif request.path != new_user_session_path
|
||
- if request.path == new_user_registration_path
|
||
%li
|
||
Vous avez déjà un compte ?
|
||
%li
|
||
= link_to "Connexion", new_user_session_path, class: "button secondary"
|