Skip to content

Commit

Permalink
_navigation.html.erb: Hide resources without index (#1524)
Browse files Browse the repository at this point in the history
  • Loading branch information
bekicot authored and pablobm committed Jan 18, 2020
1 parent 32ce01c commit 1ca811c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/views/administrate/application/_navigation.html.erb
Expand Up @@ -15,6 +15,6 @@ as defined by the routes in the `admin/` namespace
display_resource_name(resource),
[namespace, resource_index_route_key(resource)],
class: "navigation__link navigation__link--#{nav_link_state(resource)}"
) %>
) if valid_action? :index, resource %>
<% end %>
</nav>
2 changes: 1 addition & 1 deletion spec/example_app/config/routes.rb
Expand Up @@ -5,7 +5,7 @@
resources :log_entries
resources :orders
resources :products
resources :product_meta_tags
resources :product_meta_tags, except: [:index]
resources :payments, only: [:index, :show]
resources :series

Expand Down
6 changes: 6 additions & 0 deletions spec/features/navigation_spec.rb
Expand Up @@ -36,4 +36,10 @@
expect(page).to have_header("Users")
end
end

it "hides link to resources without index page" do
visit admin_customers_path
navigation = find(".navigation")
expect(navigation).not_to have_link("Product Meta Tags")
end
end

0 comments on commit 1ca811c

Please sign in to comment.