Skip to content

Commit

Permalink
Add a "back" link to the navigation
Browse files Browse the repository at this point in the history
This solves half of #271 by implementing a link to take the user back to
the main application. It's assumed that `root_url` without a namespace
returns the main application's root.
  • Loading branch information
nickcharlton committed Jul 12, 2019
1 parent 7ed5b07 commit 31f8cd9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/views/administrate/application/_navigation.html.erb
Expand Up @@ -8,6 +8,8 @@ as defined by the routes in the `admin/` namespace
%>

<nav class="navigation" role="navigation">
<%= link_to "Back to main application", root_url, class: "navigation__link" %>
<% Administrate::Namespace.new(namespace).resources.each do |resource| %>
<%= link_to(
display_resource_name(resource),
Expand Down
7 changes: 7 additions & 0 deletions spec/features/navigation_spec.rb
@@ -1,6 +1,13 @@
require "rails_helper"

describe "navigation" do
it "has the link of back to application" do
visit admin_customers_path

navigation = find(".navigation")
expect(navigation).to have_link("Back to main application")
end

it "highlights the link to the current page's resource type" do
visit admin_customers_path

Expand Down

0 comments on commit 31f8cd9

Please sign in to comment.