diff --git a/app/components/layout/admin_header_component.html.erb b/app/components/layout/admin_header_component.html.erb index 05251335a..f1be1d2f6 100644 --- a/app/components/layout/admin_header_component.html.erb +++ b/app/components/layout/admin_header_component.html.erb @@ -8,12 +8,14 @@
-
- -
+ <% if show_account_menu? %> +
+ +
+ <% end %>
@@ -25,7 +27,7 @@
- <% if show_admin_menu?(user) || namespace != "management" %> + <% if show_account_menu? %>
<%= render Layout::AccountMenuComponent.new(user) %> diff --git a/app/components/layout/admin_header_component.rb b/app/components/layout/admin_header_component.rb index 4d730dd02..3f97f9656 100644 --- a/app/components/layout/admin_header_component.rb +++ b/app/components/layout/admin_header_component.rb @@ -25,4 +25,8 @@ class Layout::AdminHeaderComponent < ApplicationComponent namespaced_root_path end end + + def show_account_menu? + show_admin_menu?(user) || namespace != "management" + end end diff --git a/spec/components/layout/admin_header_component_spec.rb b/spec/components/layout/admin_header_component_spec.rb index bbcfa319a..62a938369 100644 --- a/spec/components/layout/admin_header_component_spec.rb +++ b/spec/components/layout/admin_header_component_spec.rb @@ -9,7 +9,7 @@ describe Layout::AdminHeaderComponent do end context "management section", controller: Management::BaseController do - it "shows the menu for administrators" do + it "shows the menu button and menu for administrators" do create(:administrator, user: user) render_inline Layout::AdminHeaderComponent.new(user) @@ -19,9 +19,10 @@ describe Layout::AdminHeaderComponent do expect(page).to have_link "My content" expect(page).to have_link "My account" expect(page).to have_link "Sign out" + expect(page).to have_css "[data-toggle]" end - it "does not show the menu managers" do + it "does not show the menu button and menu for managers" do create(:manager, user: user) render_inline Layout::AdminHeaderComponent.new(user) @@ -31,6 +32,7 @@ describe Layout::AdminHeaderComponent do expect(page).not_to have_content "My content" expect(page).not_to have_content "My account" expect(page).not_to have_content "Sign out" + expect(page).not_to have_css "[data-toggle]" end end end