How can I change the order for the ActiveAdmin Comments model? With my own models I use
menu priority: NUMBER
in the Admin class. But what about its own Comments class?
How can I change the order for the ActiveAdmin Comments model? With my own models I use
menu priority: NUMBER
in the Admin class. But what about its own Comments class?
I had a similar problem with ActiveAdmin 1.0beta and wanted to post my solution for posterity.
In initializers/active_admin.rb if you add the "Comments" as a label and disable them in the menu you can move the comments to a dropdown or to the end of the main menu list.
config.show_comments_in_menu = false
#....
config.namespace :admin do |admin|
admin.build_menu do |menu|
menu.add label: 'Dashboard', priority: 0
menu.add label: 'Revenue', priority: 3
menu.add label: 'Costs', priority: 4
menu.add label: 'Categories', priority: 5
menu.add label: 'Users & Comments', priority: 6
menu.add label: 'Comments', parent: 'Users & Comments', url: "/admin/comments"
end
end
The workaround I've found was using negative numbers for menus that I want to be sure are shown before the Comments model.
Answer similar to accepted response, however, for those that want to maintain other AA menu defaults.
config.show_comments_in_menu = false
config.namespace :admin do |admin|
admin.build_menu :default do |menu|
menu.add label: 'Comments', parent: 'Misc', url: "/admin/comments"
end
end
Nowadays, you can set the Comments menu priority in config/active_admin.rb
like so:
config.comments_menu = { priority: 1 }