Module: ActiveAdmin::Resource::Menu

Included in:
Page, ActiveAdmin::Resource
Defined in:
lib/active_admin/resource/menu.rb

Instance Method Summary collapse

Instance Method Details

#include_in_menu?Boolean

Should this resource be added to the menu system?

Returns:

  • (Boolean)


38
39
40
# File 'lib/active_admin/resource/menu.rb', line 38

def include_in_menu?
  menu_options[:display] != false
end

Set the menu options. To not add this resource to the menu, just call #menu(false)



7
8
9
10
# File 'lib/active_admin/resource/menu.rb', line 7

def menu(options = {})
  options = options == false ? { :display => false } : options
  @menu_options = options
end

Returns a proc for deciding whether to display the menu item or not in the view



33
34
35
# File 'lib/active_admin/resource/menu.rb', line 33

def menu_item_display_if
  menu_options[:if] || proc { true }
end

Returns the name to be displayed in the menu for this resource



23
24
25
# File 'lib/active_admin/resource/menu.rb', line 23

def menu_item_name
  menu_options[:label] || plural_resource_name
end

Returns the items priority for altering the default sort order



28
29
30
# File 'lib/active_admin/resource/menu.rb', line 28

def menu_item_priority
  menu_options[:priority] || 10
end

The options to use for the menu



13
14
15
# File 'lib/active_admin/resource/menu.rb', line 13

def menu_options
  @menu_options ||= {}
end

#parent_menu_item_nameObject

Returns the name to put this resource under in the menu



18
19
20
# File 'lib/active_admin/resource/menu.rb', line 18

def parent_menu_item_name
  menu_options[:parent]
end