[Fix #1577] logo link in navbar on gestionnaire UI should not link to admin UI
This commit is contained in:
parent
3c9c67c883
commit
9f6d6e61fb
3 changed files with 36 additions and 1 deletions
|
@ -19,4 +19,15 @@ module ApplicationHelper
|
|||
current_gestionnaire.try(:email) ||
|
||||
current_administrateur.try(:email)
|
||||
end
|
||||
|
||||
def root_path_for_profile(nav_bar_profile)
|
||||
case nav_bar_profile
|
||||
when :gestionnaire
|
||||
gestionnaire_procedures_path
|
||||
when :user
|
||||
users_dossiers_path
|
||||
else
|
||||
root_path
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
.header-inner-content
|
||||
|
||||
.flex.align-center
|
||||
= link_to root_path, class: "header-logo" do
|
||||
= link_to root_path_for_profile(nav_bar_profile), class: "header-logo" do
|
||||
%img{ src: image_url("header/logo-ds.svg"), alt: "Logo de demarches-simplifiees.fr" }
|
||||
|
||||
- if nav_bar_profile == :gestionnaire && gestionnaire_signed_in?
|
||||
|
|
24
spec/views/layouts/_new_header_spec.rb
Normal file
24
spec/views/layouts/_new_header_spec.rb
Normal file
|
@ -0,0 +1,24 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'layouts/_new_header.html.haml', type: :view do
|
||||
describe 'logo link' do
|
||||
before do
|
||||
allow(controller).to receive(:nav_bar_profile).and_return(profile)
|
||||
render
|
||||
end
|
||||
|
||||
subject { rendered }
|
||||
|
||||
context 'when rendering for user' do
|
||||
let(:profile) { :user }
|
||||
|
||||
it { is_expected.to have_css("a.header-logo[href=\"#{users_dossiers_path}\"]") }
|
||||
end
|
||||
|
||||
context 'when rendering for gestionnaire' do
|
||||
let(:profile) { :gestionnaire }
|
||||
|
||||
it { is_expected.to have_css("a.header-logo[href=\"#{gestionnaire_procedures_path}\"]") }
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue