Merge pull request #4734 from consul/manager_header
Make management and admin headers consistent
This commit is contained in:
@@ -6,6 +6,8 @@ module AdminHelper
|
||||
def namespaced_header_title
|
||||
if namespace == "moderation/budgets"
|
||||
t("moderation.header.title")
|
||||
elsif namespace == "management"
|
||||
t("management.dashboard.index.title")
|
||||
else
|
||||
t("#{namespace}.header.title")
|
||||
end
|
||||
|
||||
@@ -34,15 +34,17 @@
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div id="responsive_menu">
|
||||
<div class="top-bar-right">
|
||||
<ul class="menu" data-responsive-menu="medium-dropdown">
|
||||
<%= render "shared/admin_login_items" %>
|
||||
<%= render "layouts/notification_item" %>
|
||||
<%= render "devise/menu/login_items" %>
|
||||
</ul>
|
||||
<% if show_admin_menu?(current_user) || namespace != "management" %>
|
||||
<div id="responsive_menu">
|
||||
<div class="top-bar-right">
|
||||
<ul class="menu" data-responsive-menu="medium-dropdown">
|
||||
<%= render "shared/admin_login_items", current_user: current_user %>
|
||||
<%= render "layouts/notification_item", current_user: current_user %>
|
||||
<%= render "devise/menu/login_items", current_user: current_user %>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
@@ -8,36 +8,7 @@
|
||||
</head>
|
||||
|
||||
<body class="admin">
|
||||
<header class="header">
|
||||
<div class="top-links">
|
||||
<%= render "shared/locale_switcher" %>
|
||||
</div>
|
||||
|
||||
<div class="expanded row admin-top-bar">
|
||||
<div class="top-bar">
|
||||
<div class="top-bar-left">
|
||||
<h1>
|
||||
<%= link_to management_root_path do %>
|
||||
<%= setting["org_name"] %>
|
||||
<br><small><%= t("management.dashboard.index.title") %></small>
|
||||
<% end %>
|
||||
</h1>
|
||||
</div>
|
||||
<% if show_admin_menu?(manager_logged_in) %>
|
||||
<div id="responsive_menu">
|
||||
|
||||
<div class="top-bar-right">
|
||||
<ul class="menu" data-responsive-menu="medium-dropdown">
|
||||
<%= render "shared/admin_login_items", current_user: manager_logged_in %>
|
||||
<%= render "devise/menu/login_items", current_user: manager_logged_in %>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
<%= render "layouts/admin_header", current_user: manager_logged_in %>
|
||||
|
||||
<div class="menu-and-content">
|
||||
<%= check_box_tag :show_menu, nil, false, role: "switch" %>
|
||||
|
||||
@@ -2,6 +2,7 @@ require "rails_helper"
|
||||
|
||||
describe "Management" do
|
||||
let(:user) { create(:user) }
|
||||
before { Setting["org_name"] = "CONSUL" }
|
||||
|
||||
scenario "Should show admin menu if logged user is admin" do
|
||||
create(:administrator, user: user)
|
||||
@@ -11,9 +12,12 @@ describe "Management" do
|
||||
click_link "Menu"
|
||||
click_link "Management"
|
||||
|
||||
expect(page).to have_content("My content")
|
||||
expect(page).to have_content("My account")
|
||||
expect(page).to have_content("Sign out")
|
||||
expect(page).to have_link "Go back to CONSUL"
|
||||
|
||||
expect(page).to have_link "You don't have new notifications"
|
||||
expect(page).to have_link "My content"
|
||||
expect(page).to have_link "My account"
|
||||
expect(page).to have_link "Sign out"
|
||||
end
|
||||
|
||||
scenario "Should not show admin menu if logged user is manager" do
|
||||
@@ -24,8 +28,11 @@ describe "Management" do
|
||||
click_link "Menu"
|
||||
click_link "Management"
|
||||
|
||||
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).to have_link "Go back to CONSUL"
|
||||
|
||||
expect(page).not_to have_content "You don't have new notifications"
|
||||
expect(page).not_to have_content "My content"
|
||||
expect(page).not_to have_content "My account"
|
||||
expect(page).not_to have_content "Sign out"
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user