summaryrefslogtreecommitdiffstats
path: root/app/controllers/context_menus_controller.rb
diff options
context:
space:
mode:
authorJean-Baptiste Barth <jeanbaptiste.barth@gmail.com>2010-10-08 03:09:51 +0000
committerJean-Baptiste Barth <jeanbaptiste.barth@gmail.com>2010-10-08 03:09:51 +0000
commit156eca4d223efce4abd67c9ef7b129a3d07d83e6 (patch)
treedc61c3fa752872267c3b964c1716374720bb10ba /app/controllers/context_menus_controller.rb
parent73f12765a99b6d78c5d23a58fe887c79a4012e99 (diff)
downloadredmine-156eca4d223efce4abd67c9ef7b129a3d07d83e6.tar.gz
redmine-156eca4d223efce4abd67c9ef7b129a3d07d83e6.zip
Added ability to edit issues from different project through contextual menu (#5332)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4242 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers/context_menus_controller.rb')
-rw-r--r--app/controllers/context_menus_controller.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/app/controllers/context_menus_controller.rb b/app/controllers/context_menus_controller.rb
index ae8517243..3e1438306 100644
--- a/app/controllers/context_menus_controller.rb
+++ b/app/controllers/context_menus_controller.rb
@@ -16,9 +16,9 @@ class ContextMenusController < ApplicationController
@projects = @issues.collect(&:project).compact.uniq
@project = @projects.first if @projects.size == 1
- @can = {:edit => (@project && User.current.allowed_to?(:edit_issues, @project)),
+ @can = {:edit => User.current.allowed_to?(:edit_issues, @projects),
:log_time => (@project && User.current.allowed_to?(:log_time, @project)),
- :update => (@project && (User.current.allowed_to?(:edit_issues, @project) || (User.current.allowed_to?(:change_status, @project) && @allowed_statuses && !@allowed_statuses.empty?))),
+ :update => (User.current.allowed_to?(:edit_issues, @projects) || (User.current.allowed_to?(:change_status, @projects) && !@allowed_statuses.blank?)),
:move => (@project && User.current.allowed_to?(:move_issues, @project)),
:copy => (@issue && @project.trackers.include?(@issue.tracker) && User.current.allowed_to?(:add_issues, @project)),
:delete => User.current.allowed_to?(:delete_issues, @projects)
@@ -27,6 +27,10 @@ class ContextMenusController < ApplicationController
@assignables = @project.assignable_users
@assignables << @issue.assigned_to if @issue && @issue.assigned_to && !@assignables.include?(@issue.assigned_to)
@trackers = @project.trackers
+ else
+ #when multiple projects, we only keep the intersection of each set
+ @assignables = @projects.map(&:assignable_users).inject{|memo,a| memo & a}
+ @trackers = @projects.map(&:trackers).inject{|memo,t| memo & t}
end
@priorities = IssuePriority.all.reverse