Module: Redmine::MenuManager::MenuController
- Included in:
- ApplicationController
- Defined in:
- lib/redmine/menu_manager.rb
Overview
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
-
#current_menu_item ⇒ Object
Returns the menu item name according to the current action.
- #menu_items ⇒ Object
-
#redirect_to_project_menu_item(project, name) ⇒ Object
Redirects user to the menu item of the given project Returns false if user is not authorized.
Instance Method Details
#current_menu_item ⇒ Object
Returns the menu item name according to the current action
55 56 57 58 |
# File 'lib/redmine/menu_manager.rb', line 55 def @current_menu_item ||= [controller_name.to_sym][:actions][action_name.to_sym] || [controller_name.to_sym][:default] end |
#menu_items ⇒ Object
50 51 52 |
# File 'lib/redmine/menu_manager.rb', line 50 def self.class. end |
#redirect_to_project_menu_item(project, name) ⇒ Object
Redirects user to the menu item of the given project Returns false if user is not authorized
62 63 64 65 66 67 68 69 |
# File 'lib/redmine/menu_manager.rb', line 62 def (project, name) item = Redmine::MenuManager.items(:project_menu).detect {|i| i.name.to_s == name.to_s} if item && item.allowed?(User.current, project) redirect_to({item.param => project}.merge(item.url)) return true end false end |