Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

_navigation.html.erb: Hide resources without index #1524

Merged
merged 1 commit into from Jan 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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