summaryrefslogtreecommitdiffstats
path: root/app/controllers/context_menus_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/context_menus_controller.rb')
-rw-r--r--app/controllers/context_menus_controller.rb33
1 files changed, 33 insertions, 0 deletions
diff --git a/app/controllers/context_menus_controller.rb b/app/controllers/context_menus_controller.rb
new file mode 100644
index 000000000..442f85b37
--- /dev/null
+++ b/app/controllers/context_menus_controller.rb
@@ -0,0 +1,33 @@
+class ContextMenusController < ApplicationController
+ helper :watchers
+
+ def issues
+ @issues = Issue.find_all_by_id(params[:ids], :include => :project)
+ if (@issues.size == 1)
+ @issue = @issues.first
+ @allowed_statuses = @issue.new_statuses_allowed_to(User.current)
+ end
+ projects = @issues.collect(&:project).compact.uniq
+ @project = projects.first if projects.size == 1
+
+ @can = {:edit => (@project && User.current.allowed_to?(:edit_issues, @project)),
+ :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?))),
+ :move => (@project && User.current.allowed_to?(:move_issues, @project)),
+ :copy => (@issue && @project.trackers.include?(@issue.tracker) && User.current.allowed_to?(:add_issues, @project)),
+ :delete => (@project && User.current.allowed_to?(:delete_issues, @project))
+ }
+ if @project
+ @assignables = @project.assignable_users
+ @assignables << @issue.assigned_to if @issue && @issue.assigned_to && !@assignables.include?(@issue.assigned_to)
+ @trackers = @project.trackers
+ end
+
+ @priorities = IssuePriority.all.reverse
+ @statuses = IssueStatus.find(:all, :order => 'position')
+ @back = back_url
+
+ render :layout => false
+ end
+
+end