diff options
author | Eric Davis <edavis@littlestreamsoftware.com> | 2010-08-19 18:16:54 +0000 |
---|---|---|
committer | Eric Davis <edavis@littlestreamsoftware.com> | 2010-08-19 18:16:54 +0000 |
commit | 1fcc1bdc89ef4e92e4e02d917593a8ef2b4f370e (patch) | |
tree | 48ccb24a26d9e4d9346edd0925209dc23ed2377c /app/controllers/context_menus_controller.rb | |
parent | 57372d9d8e8ce54eb1b6a5ed21b4cb0b3f29c69a (diff) | |
download | redmine-1fcc1bdc89ef4e92e4e02d917593a8ef2b4f370e.tar.gz redmine-1fcc1bdc89ef4e92e4e02d917593a8ef2b4f370e.zip |
Refactor: move IssuesController#context_menu to a new controller.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4006 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers/context_menus_controller.rb')
-rw-r--r-- | app/controllers/context_menus_controller.rb | 33 |
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 |