demarches-normaliennes/app/views/layouts/_new_header.haml
2019-08-12 13:47:01 +02:00

71 lines
3.1 KiB
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

-# We can't use &. because the controller may not implement #nav_bar_profile
- nav_bar_profile = controller.try(:nav_bar_profile) || :guest
- dossier = controller.try(:dossier_for_help)
- procedure = controller.try(:procedure_for_help)
.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", title: "Revenir à laccueil"
- if nav_bar_profile == :instructeur && instructeur_signed_in?
- current_url = request.path_info
%ul.header-tabs
- if current_instructeur.visible_procedures.count > 0
%li
= active_link_to "Démarches", instructeur_procedures_path, active: :inclusive, class: 'tab-link'
- if current_instructeur.avis.count > 0
%li
= active_link_to instructeur_avis_index_path, active: :inclusive, class: 'tab-link' do
Avis
- avis_counter = current_instructeur.avis.without_answer.count
- if avis_counter > 0
%span.badge.warning= avis_counter
- 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 == :instructeur && instructeur_signed_in?
%li
.header-search
= form_tag instructeur_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 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
- 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"
%li
.header-help
- 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 nav_bar_profile == :instructeur
= render partial: 'shared/help/help_dropdown_instructeur'
- else
= render partial: 'shared/help/help_button'