Skip to content

Commit

Permalink
fix fropdown navbar profile
Browse files Browse the repository at this point in the history
  • Loading branch information
lisa-durand committed Jul 12, 2023
1 parent 97e4cf4 commit d647d07
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 18 deletions.
4 changes: 4 additions & 0 deletions app/controllers/administrateurs/administrateur_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ class AdministrateurController < ApplicationController
before_action :authenticate_administrateur!
helper_method :administrateur_as_manager?

def nav_bar_profile
:administrateur
end

def retrieve_procedure
id = params[:procedure_id] || params[:id]

Expand Down
33 changes: 15 additions & 18 deletions app/views/layouts/_account_dropdown.haml
Original file line number Diff line number Diff line change
@@ -1,43 +1,40 @@
%nav.fr-translate.fr-nav{ role: "navigation", "aria-label"=> t('menu_aria_label', scope: [:layouts]) }
.fr-nav__item
%button.account-btn.fr-translate__btn.fr-btn{ "aria-controls" => "account", "aria-expanded" => "false", :title => t('my_account', scope: [:layouts]) }
= image_tag "icons/account-circle.svg", alt: t('my_account', scope: [:layouts]), width: 20, height: 20, loading: 'lazy'
&nbsp;
= " #{current_email}"
#account.fr-collapse.fr-menu
%ul.fr-menu__list
- if super_admin_signed_in?
%li
= link_to manager_root_path, class: "fr-nav__link flex align-center" do
= image_tag "icons/super-admin.svg", alt: '',width: 20, height: 20, class: 'mr-1'
= t('go_superadmin', scope: [:layouts])
- if multiple_devise_profile_connect?
%li
= link_to "#", class: "fr-nav__link", "aria-current" => "true" do
= t("connected_as_#{nav_bar_profile}", scope: [:layouts])

- if user_signed_in? && nav_bar_profile != :user
%li
= link_to dossiers_path, class: "fr-nav__link flex align-center" do
= image_tag "icons/switch-profile.svg", alt: '', width: 20, height: 20, class: 'mr-1'
= link_to dossiers_path, class: "fr-nav__link" do
= t('go_user', scope: [:layouts])
- if instructeur_signed_in? && nav_bar_profile != :instructeur
%li
= link_to instructeur_procedures_path, class: "fr-nav__link flex align-center" do
= image_tag "icons/switch-profile.svg", alt: '', width: 20, height: 20, class: 'mr-1'
= link_to instructeur_procedures_path, class: "fr-nav__link" do
= t('go_instructor', scope: [:layouts])
- if expert_signed_in? && nav_bar_profile != :expert
%li
= link_to expert_all_avis_path, class: "fr-nav__link flex align-center" do
= image_tag "icons/switch-profile.svg", alt: '', width: 20, height: 20, class: 'mr-1'
= link_to expert_all_avis_path, class: "fr-nav__link" do
= t('go_expert', scope: [:layouts])
- if administrateur_signed_in? && nav_bar_profile != :administrateur
%li
= link_to admin_procedures_path, class: "fr-nav__link flex align-center" do
= image_tag "icons/switch-profile.svg", alt: '', width: 20, height: 20, class: 'mr-1'
= link_to admin_procedures_path, class: "fr-nav__link" do
= t('go_admin', scope: [:layouts])

%li
= link_to profil_path, class: "fr-nav__link flex align-center" do
= image_tag "icons/switch-profile.svg", alt: '', width: 20, height: 20, class: 'mr-1'
= link_to profil_path, class: "fr-nav__link" do
= t('profile', scope: [:layouts])
%li
= link_to destroy_user_session_path, method: :delete, class: "fr-nav__link flex align-center" do
= image_tag "icons/sign-out.svg", alt: '', width: 20, height: 20, class: 'mr-1'
= link_to destroy_user_session_path, method: :delete, class: "fr-nav__link" do
= t('logout', scope: [:layouts])

- if super_admin_signed_in?
%li
= link_to manager_root_path, class: "fr-nav__link" do
= t('go_superadmin', scope: [:layouts])
5 changes: 5 additions & 0 deletions config/locales/views/layouts/_account_dropdown.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,8 @@ en:
profile: "See my profile"
logout: "Log out"
my_account: "My account"
connected_as_user: "connected as user"
connected_as_instructeur: "connected as instructor"
connected_as_administrateur: "connected as admin"
connected_as_super_admin: "connecté en tant que super admin"
connected_as_super_expert: "connected as expert"
5 changes: 5 additions & 0 deletions config/locales/views/layouts/_account_dropdown.fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,8 @@ fr:
profile: "Voir mon profil"
logout: "Se déconnecter"
my_account: "Mon compte"
connected_as_user: "connecté en tant qu'utilisateur"
connected_as_instructeur: "connecté en tant qu'instructeur"
connected_as_administrateur: "connecté en tant qu'administrateur"
connected_as_super_admin: "connecté en tant que super admin"
connected_as_super_expert: "connecté en tant qu'expert"

0 comments on commit d647d07

Please sign in to comment.