I am setting the menu :priority => 1 and the next tab I am setting to 2 and active admin is displaying the second tab first. How do I fix this, what am I doing wrong? The first tab has a sub tab.
ActiveAdmin.register Article do
menu :priority => 1
ActiveAdmin.register Article, :as => 'ArticleReview' do
menu :priority => 1, :parent => "Articles", :label => "Review Articles"
ActiveAdmin.register Grids do
menu :priority => 2
First of all, I don't know why you'd ever want to register Article twice under two separate names...
I don't recall the reason currently, but in my app I have all of the "parent" links (Articles and Grids in your case) ordered from 10 onwards. So going left to right, they have priorities of 10, 11, 12, etc. In this configuration it works fine for me.
Im actually registering the ArticleReview model which inherits from Article but has a default scope.
I've encountered this problem when I've 2 parents, I can't set my parents element in the order that I want. I can only do this by setting numbers in the name of my parents because I've discovered that parent not used the priority when it's greater than one but they use the alphabetical order, but I've find my trick very ugly.
Have a look on my screen :
Here's an explanation from this file:
# @option options [Integer] :priority
# MenuItems are sorted by priority then by label. The lower the priority, the
# earlier in the menu the item will be displayed.
# Default: 10
Hence why my previously mentioned solution worked. @keysen, can you try and see if it works for you? That is, specifically use a priority greater than 10 for every top-level menu item.
I am also having an issue with :priority. It appears that menus with children are displayed first despite the priority setting. Is this because the :priority is for ordering submenu items only?
@dyohi read my above post. The only case that doesn't handle is when you have a parent menu that itself doesn't belong to a model, because there's no way to currently set priority for such an entity. Thus, it defaults to a priority of 10.
@Daxter thanks for the advise, Indeed I tried to play with priority, but nothing change.
@keysen, I'm guessing here (since I don't speak French), but it appears you're using top-level menus that aren't associated with an AA page/model. It's that situation that doesn't work, because there's no way currently to set a priority for such a menu item.
@daxter You're right they aren't associated :). Finally it's a bug, because the user can't use these submenu and the navbar is limited in space.
The trick's in doing a seperated resource which are only a container of submenu with 2 params like name, position
I'm not enough habituated with rails to do this, I'm in phase of learning, so, I wait someone implement this :s.
Moved to #1488.