Jump to the current tab when using the project quick-jump combo (#2364).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2210 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2008-12-30 14:24:51 +00:00
parent 6eee9dbf88
commit 2355324d73
4 changed files with 37 additions and 4 deletions
+13 -2
View File
@@ -52,8 +52,19 @@ module Redmine
# Returns the menu item name according to the current action
def current_menu_item
menu_items[controller_name.to_sym][:actions][action_name.to_sym] ||
menu_items[controller_name.to_sym][:default]
@current_menu_item ||= menu_items[controller_name.to_sym][:actions][action_name.to_sym] ||
menu_items[controller_name.to_sym][:default]
end
# Redirects user to the menu item of the given project
# Returns false if user is not authorized
def redirect_to_project_menu_item(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
end