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
- #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.
59 60 61 |
# File 'lib/active_admin/resource/menu.rb', line 59 def @menu_item end |
Instance Method Details
#add_to_menu(menu_collection) ⇒ Object
53 54 55 56 57 |
# File 'lib/active_admin/resource/menu.rb', line 53 def () if @menu_item = .add , end end |
#default_menu_options ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/active_admin/resource/menu.rb', line 24 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?
62 63 64 |
# File 'lib/active_admin/resource/menu.rb', line 62 def @include_in_menu != false end |
#menu_item_options ⇒ Object
20 21 22 |
# File 'lib/active_admin/resource/menu.rb', line 20 def @menu_item_options ||= end |
#menu_item_options=(options) ⇒ Object
Set the menu options. To disable this menu item, call ‘menu(false)` from the DSL
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/active_admin/resource/menu.rb', line 9 def () if == false @include_in_menu = false @menu_item_options = {} else @include_in_menu = true @navigation_menu_name = [:menu_name] @menu_item_options = .merge end end |
#navigation_menu ⇒ Object
49 50 51 |
# File 'lib/active_admin/resource/menu.rb', line 49 def namespace.() end |
#navigation_menu_name ⇒ Object
40 41 42 43 44 45 46 47 |
# File 'lib/active_admin/resource/menu.rb', line 40 def case @navigation_menu_name ||= DEFAULT_MENU when Proc controller.instance_exec(&@navigation_menu_name).to_sym else @navigation_menu_name end end |
#navigation_menu_name=(menu_name) ⇒ Object
36 37 38 |
# File 'lib/active_admin/resource/menu.rb', line 36 def () self. = { menu_name: } end |