Module: Redmine::MenuManager::MenuController
- Included in:
- ApplicationController
- Defined in:
- lib/redmine/menu_manager/menu_controller.rb
Overview
– copyright ChiliProject is a project management system.
Copyright (C) 2010-2013 the ChiliProject Team
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
See doc/COPYRIGHT.rdoc for more details. ++
Defined Under Namespace
Modules: ClassMethods
Class Method Summary (collapse)
Instance Method Summary (collapse)
-
- (Object) current_menu_item
Returns the menu item name according to the current action.
- - (Object) menu_items
-
- (Object) redirect_to_project_menu_item(project, name)
Redirects user to the menu item of the given project Returns false if user is not authorized.
Class Method Details
+ (Object) included(base)
16 17 18 |
# File 'lib/redmine/menu_manager/menu_controller.rb', line 16 def self.included(base) base.extend(ClassMethods) end |
Instance Method Details
- (Object) current_menu_item
Returns the menu item name according to the current action
47 48 49 50 |
# File 'lib/redmine/menu_manager/menu_controller.rb', line 47 def @current_menu_item ||= [controller_name.to_sym][:actions][action_name.to_sym] || [controller_name.to_sym][:default] end |
- (Object) menu_items
42 43 44 |
# File 'lib/redmine/menu_manager/menu_controller.rb', line 42 def self.class. end |
- (Object) redirect_to_project_menu_item(project, name)
Redirects user to the menu item of the given project Returns false if user is not authorized
54 55 56 57 58 59 60 61 |
# File 'lib/redmine/menu_manager/menu_controller.rb', line 54 def (project, name) item = Redmine::MenuManager.items(:project_menu).detect {|i| i.name.to_s == name.to_s} if item && User.current.allowed_to?(item.url, project) && (item.condition.nil? || item.condition.call(project)) redirect_to({item.param => project}.merge(item.url)) return true end false end |