Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ActiveAdmin menu ordering for Admin Comments model

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?

like image 711
MegaTux Avatar asked Aug 08 '13 14:08

MegaTux


3 Answers

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
# if active_admin >= 1.0, use `config.comments_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
like image 165
Jeb Avatar answered Oct 24 '22 06:10

Jeb


Nowadays, you can set the Comments menu priority in config/active_admin.rb like so:

config.comments_menu = { priority: 1 }
like image 3
lightyrs Avatar answered Oct 24 '22 06:10

lightyrs


The workaround I've found was using negative numbers for menus that I want to be sure are shown before the Comments model.

like image 1
MegaTux Avatar answered Oct 24 '22 05:10

MegaTux