Module: ActiveAdmin::Resource::Menu
- Included in:
- Page, ActiveAdmin::Resource
- Defined in:
- lib/active_admin/resource/menu.rb
Instance Attribute Summary collapse
-
#menu_item ⇒ Object
readonly
Returns the value of attribute menu_item.
Instance Method Summary collapse
-
#add_to_menu(menu_collection) ⇒ Object
Invoked by namespace when menu is about to be rendered.
- #default_menu_options ⇒ Object
-
#include_in_menu? ⇒ Boolean
Should this resource be added to the menu system?.
- #menu_item_options ⇒ Object
-
#menu_item_options=(options) ⇒ Object
Set the menu options.
- #navigation_menu ⇒ Object
- #navigation_menu_name ⇒ Object
- #navigation_menu_name=(menu_name) ⇒ Object
Instance Attribute Details
#menu_item ⇒ Object (readonly)
Returns the value of attribute menu_item.
56 57 58 |
# File 'lib/active_admin/resource/menu.rb', line 56 def @menu_item end |
Instance Method Details
#add_to_menu(menu_collection) ⇒ Object
Invoked by namespace when menu is about to be rendered.
50 51 52 53 54 |
# File 'lib/active_admin/resource/menu.rb', line 50 def () if @menu_item = .add , end end |
#default_menu_options ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/active_admin/resource/menu.rb', line 17 def # These local variables are accessible to the procs. = respond_to?(:resource_class) ? resource_class : self resource = self { id: resource_name.plural, label: proc{ resource.plural_resource_label }, url: proc{ resource.route_collection_path(params, ) }, if: proc{ (Auth::READ, ) } } end |
#include_in_menu? ⇒ Boolean
Should this resource be added to the menu system?
59 60 61 |
# File 'lib/active_admin/resource/menu.rb', line 59 def @menu_item_options != false end |
#menu_item_options ⇒ Object
12 13 14 15 |
# File 'lib/active_admin/resource/menu.rb', line 12 def @menu_item_options ||= {} @menu_item_options.reverse_merge() end |
#menu_item_options=(options) ⇒ Object
Set the menu options. To disable this menu item, call ‘menu(false)` from the DSL
8 9 10 |
# File 'lib/active_admin/resource/menu.rb', line 8 def () @menu_item_options = end |
#navigation_menu ⇒ Object
45 46 47 |
# File 'lib/active_admin/resource/menu.rb', line 45 def namespace.() end |
#navigation_menu_name ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/active_admin/resource/menu.rb', line 33 def = @menu_item_options[:menu_name] if @menu_item_options ||= DEFAULT_MENU case when Proc controller.instance_exec(&).to_sym else end end |
#navigation_menu_name=(menu_name) ⇒ Object
29 30 31 |
# File 'lib/active_admin/resource/menu.rb', line 29 def () self. = { menu_name: } end |