You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It doesn't make much sense to look at a list of millions of line items. It makes sense to go through the order and check its list of line items there. I decided to remove line items it from the navigation but I still want line items to appear as a nested resource in Order#show.
The navigation simply renders all resources defined in the routes. So removing line_items from the routes will remove it from the navigation, but it will break the app when I open Order#show because it also uses the line items paths.
Right now there's no possibility to remove a resource from the navigation while keeping it as a nested resources. (Overriding _navigation partial and hardcode the entries is obviously not the right way)
While writing this issue I was playing around with an implementation to add configuration to Dashboards, like this:
# dashboards/line_item_dashboard.rb
class LineItemDashboard < Administrate::BaseDashboard
configure do |config|
config.navigation = false
end
...
end
Then I introduced a Administrate::Navigation class collecting all resources configured to be displayed in the navigation. In the _navigation.html.erb partial I iterate through Navigation#resources
It works like a charm. Is it worth sending a PR?
The text was updated successfully, but these errors were encountered:
I have models like this:
Order
has manyLineItem
It doesn't make much sense to look at a list of millions of line items. It makes sense to go through the order and check its list of line items there. I decided to remove line items it from the navigation but I still want line items to appear as a nested resource in Order#show.
The navigation simply renders all resources defined in the routes. So removing
line_items
from the routes will remove it from the navigation, but it will break the app when I open Order#show because it also uses the line items paths.Right now there's no possibility to remove a resource from the navigation while keeping it as a nested resources. (Overriding
_navigation
partial and hardcode the entries is obviously not the right way)While writing this issue I was playing around with an implementation to add configuration to Dashboards, like this:
Then I introduced a
Administrate::Navigation
class collecting all resources configured to be displayed in the navigation. In the_navigation.html.erb
partial I iterate throughNavigation#resources
It works like a charm. Is it worth sending a PR?
The text was updated successfully, but these errors were encountered: