Move admin header partial to a component
This way it's easier to refactor it. Note we're using `with_request_url` in the tests because the component renders the locale switcher, which needs a URL in order to work. This doesn't affect whether we're in the management section or not.
This commit is contained in:
50
app/components/layout/admin_header_component.html.erb
Normal file
50
app/components/layout/admin_header_component.html.erb
Normal file
@@ -0,0 +1,50 @@
|
||||
<header class="header">
|
||||
<div class="top-links">
|
||||
<%= render "shared/locale_switcher" %>
|
||||
|
||||
<%= link_to root_path do %>
|
||||
<%= t("admin.dashboard.index.back", org: setting["org_name"]) %>
|
||||
<% end %>
|
||||
</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>
|
||||
|
||||
<div class="top-bar">
|
||||
<div class="top-bar-left">
|
||||
<% if namespace == "officing" %>
|
||||
<h1>
|
||||
<%= link_to "#" do %>
|
||||
<%= setting["org_name"] %>
|
||||
<br><small><%= namespaced_header_title %></small>
|
||||
<% end %>
|
||||
</h1>
|
||||
<% else %>
|
||||
<h1>
|
||||
<%= link_to namespaced_root_path do %>
|
||||
<%= setting["org_name"] %>
|
||||
<br><small><%= namespaced_header_title %></small>
|
||||
<% end %>
|
||||
</h1>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<% if show_admin_menu?(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: user %>
|
||||
<%= render "layouts/notification_item", current_user: user %>
|
||||
<%= render "devise/menu/login_items", current_user: user %>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
Reference in New Issue
Block a user