Deface::Override.new(:virtual_path => "spree/layouts/admin",
:name => "backend_logo",
:replace => 'erb[loud]:contains("spree/admin/shared/header")',
:partial => "layouts/backend_navbar")
I made a partial in layouts by copying the one on GitHub that matches the build (stable 3) of Spree I am using but replaced the Logo with an h3
heading.
It works, the heading comes up but the rest (sidebar-toggle
and admin_login_navigation_bar
) are no longer inline. sidebar-toggle
is sitting under the sidebar and admin_login_navigation_bar
has disappeared.
I thought it might be the CSS so I gave the h3
tag the same id and class as the image tag, as you can see below on either side of <h3>Boogie</h3>
. I know there's probably a better way, like an override that just replaces the logo. I did that for the frontend but couldn't get it to work for the backend. Now I've played with this one so long that I'd really like to know what gives in this case.
<% admin = try_spree_current_user.try(:has_spree_role?, "admin") %>
<header class="header <%= admin ? "logged-in" : "logged-out" %>">
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container-fluid">
<div class="row">
<div class="navbar-header col-sm-3 col-md-2">
<h3 id="logo" class: "logo navbar-brand">Boogie</h3>
<% if admin %>
<span class="navbar-toggle" id="sidebar-toggle">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</span>
<% end %>
</div>
<% if admin %>
<div class="col-sm-9 col-md-10">
<div class="navbar-right" data-hook="admin_login_navigation_bar"></div>
</div>
<% end %>
</div>
</div>
</nav>
</header>