Module: Kitestrings::Menu::Controller
- Defined in:
- lib/kitestrings/menu/controller.rb
Instance Method Summary collapse
-
#current_menu_item ⇒ Object
get the menu item for the contextual menu (second row).
-
#loaded_menu_items ⇒ Object
return an array of the menu items constructed as polymorphic paths.
Instance Method Details
#current_menu_item ⇒ Object
get the menu item for the contextual menu (second row). On an index page, this is the item the index is nested under, if present. For normal pages it is the last item in the array.
16 17 18 19 20 21 22 |
# File 'lib/kitestrings/menu/controller.rb', line 16 def if action_name == "index" [-2] else [-1] end end |
#loaded_menu_items ⇒ Object
return an array of the menu items constructed as polymorphic paths. For example, if loaded_resources was:
- Company:1, Project:2, Audit:3
-
then this would return an array of Menu::Item objects for the following paths:
- /companies/1
- /companies/1/projects/2
- /companies/1/projects/2/audits/3
Each item is constructed with polymorphic path
10 11 12 |
# File 'lib/kitestrings/menu/controller.rb', line 10 def @loaded_menu_items ||= Menu::ItemCollection.new(loaded_resources) end |