summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorEric Davis <edavis@littlestreamsoftware.com>2010-08-10 15:11:11 +0000
committerEric Davis <edavis@littlestreamsoftware.com>2010-08-10 15:11:11 +0000
commit52c624aabd5540a64b8a481a834b641f2dae4044 (patch)
tree079925c197507c0100c625a5dcacc72ba4ef732a /app
parent424b4825793ee71faa0e36e40c813bef713ca5f6 (diff)
downloadredmine-52c624aabd5540a64b8a481a834b641f2dae4044.tar.gz
redmine-52c624aabd5540a64b8a481a834b641f2dae4044.zip
Refactor: extract method from #move and #perform_move.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3932 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r--app/controllers/issues_controller.rb27
1 files changed, 13 insertions, 14 deletions
diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb
index a7e227c85..46c61ea0f 100644
--- a/app/controllers/issues_controller.rb
+++ b/app/controllers/issues_controller.rb
@@ -251,25 +251,14 @@ class IssuesController < ApplicationController
end
def move
- @issues.sort!
- @copy = params[:copy_options] && params[:copy_options][:copy]
- @allowed_projects = Issue.allowed_target_projects_on_move
- @target_project = @allowed_projects.detect {|p| p.id.to_s == params[:new_project_id]} if params[:new_project_id]
- @target_project ||= @project
- @trackers = @target_project.trackers
- @available_statuses = Workflow.available_statuses(@project)
+ prepare_for_issue_move
render :layout => false if request.xhr?
end
# TODO: more descriptive name? move to separate controller like IssueMovesController?
def perform_move
- @issues.sort!
- @copy = params[:copy_options] && params[:copy_options][:copy]
- @allowed_projects = Issue.allowed_target_projects_on_move
- @target_project = @allowed_projects.detect {|p| p.id.to_s == params[:new_project_id]} if params[:new_project_id]
- @target_project ||= @project
- @trackers = @target_project.trackers
- @available_statuses = Workflow.available_statuses(@project)
+ prepare_for_issue_move
+
if request.post?
new_tracker = params[:new_tracker_id].blank? ? nil : @target_project.trackers.find_by_id(params[:new_tracker_id])
unsaved_issue_ids = []
@@ -473,6 +462,16 @@ private
@allowed_statuses = @issue.new_statuses_allowed_to(User.current, true)
end
+ def prepare_for_issue_move
+ @issues.sort!
+ @copy = params[:copy_options] && params[:copy_options][:copy]
+ @allowed_projects = Issue.allowed_target_projects_on_move
+ @target_project = @allowed_projects.detect {|p| p.id.to_s == params[:new_project_id]} if params[:new_project_id]
+ @target_project ||= @project
+ @trackers = @target_project.trackers
+ @available_statuses = Workflow.available_statuses(@project)
+ end
+
def set_flash_from_bulk_issue_save(issues, unsaved_issue_ids)
if unsaved_issue_ids.empty?
flash[:notice] = l(:notice_successful_update) unless issues.empty?