Hide menu button to managers on small screens
This menu isn't rendered in this case, so the "menu" button to toggle it did nothing.
This commit is contained in:
@@ -8,12 +8,14 @@
|
||||
</div>
|
||||
|
||||
<div class="expanded row admin-top-bar">
|
||||
<div class="title-bar" data-responsive-toggle="responsive_menu" data-hide-for="medium">
|
||||
<button class="menu-button" type="button" data-toggle="responsive_menu">
|
||||
<span class="menu-icon"></span>
|
||||
<span class="title-bar-title"><%= t("application.menu") %></span>
|
||||
</button>
|
||||
</div>
|
||||
<% if show_account_menu? %>
|
||||
<div class="title-bar" data-responsive-toggle="responsive_menu" data-hide-for="medium">
|
||||
<button class="menu-button" type="button" data-toggle="responsive_menu">
|
||||
<span class="menu-icon"></span>
|
||||
<span class="title-bar-title"><%= t("application.menu") %></span>
|
||||
</button>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="top-bar">
|
||||
<div class="top-bar-left">
|
||||
@@ -25,7 +27,7 @@
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
<% if show_admin_menu?(user) || namespace != "management" %>
|
||||
<% if show_account_menu? %>
|
||||
<div id="responsive_menu">
|
||||
<div class="top-bar-right">
|
||||
<%= render Layout::AccountMenuComponent.new(user) %>
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user