##// END OF EJS Templates
Make sure that tests restore the attachments path to the tmp dir so that fixture files don't get deleted....
Make sure that tests restore the attachments path to the tmp dir so that fixture files don't get deleted. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8248 e93f8b46-1217-0410-a6f0-8f06a7374b81

File last commit:

r8092:7d2298f39c60
r8128:ad25e3807d2d
Show More
issue_moves_controller.rb
85 lines | 3.1 KiB | text/x-ruby | RubyLexer
/ app / controllers / issue_moves_controller.rb
Jean-Philippe Lang
Set menu item for IssueMovesController....
r6185 # Redmine - project management software
# Copyright (C) 2006-2011 Jean-Philippe Lang
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
Toshi MARUYAMA
remove trailing white-spaces from app/controllers/issue_moves_controller.rb....
r6770 #
Jean-Philippe Lang
Set menu item for IssueMovesController....
r6185 # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
Toshi MARUYAMA
remove trailing white-spaces from app/controllers/issue_moves_controller.rb....
r6770 #
Jean-Philippe Lang
Set menu item for IssueMovesController....
r6185 # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Eric Davis
Refactor: Extract a new IssueMovesController from IssuesController....
r3822 class IssueMovesController < ApplicationController
Jean-Philippe Lang
Set menu item for IssueMovesController....
r6185 menu_item :issues
Toshi MARUYAMA
remove trailing white-spaces from app/controllers/issue_moves_controller.rb....
r6770
Eric Davis
Refactor: Extract a new IssueMovesController from IssuesController....
r3822 default_search_scope :issues
Jean-Baptiste Barth
Splitted #find_issues filter in ApplicationController to #find_issues and #check_project_uniqueness (#5332)...
r4114 before_filter :find_issues, :check_project_uniqueness
Eric Davis
Refactor: Extract a new IssueMovesController from IssuesController....
r3822 before_filter :authorize
Toshi MARUYAMA
remove trailing white-spaces from issue moves controller source....
r5701
Eric Davis
Refactor: Extract a new IssueMovesController from IssuesController....
r3822 def new
prepare_for_issue_move
render :layout => false if request.xhr?
end
def create
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 = []
moved_issues = []
@issues.each do |issue|
issue.reload
call_hook(:controller_issues_move_before_save, { :params => params, :issue => issue, :target_project => @target_project, :copy => !!@copy })
Etienne Massip
Save an @Issue#save@....
r8092 if r = issue.move_to_project(@target_project, new_tracker, {:copy => @copy, :attributes => extract_changed_attributes_for_move(params), :notes => @notes})
Eric Davis
Refactor: Extract a new IssueMovesController from IssuesController....
r3822 moved_issues << r
else
unsaved_issue_ids << issue.id
end
end
set_flash_from_bulk_issue_save(@issues, unsaved_issue_ids)
if params[:follow]
if @issues.size == 1 && moved_issues.size == 1
redirect_to :controller => 'issues', :action => 'show', :id => moved_issues.first
else
redirect_to :controller => 'issues', :action => 'index', :project_id => (@target_project || @project)
end
else
redirect_to :controller => 'issues', :action => 'index', :project_id => @project
end
return
end
end
private
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]
Toshi MARUYAMA
remove trailing white-spaces from issue moves controller source....
r5701 @target_project ||= @project
Eric Davis
Refactor: Extract a new IssueMovesController from IssuesController....
r3822 @trackers = @target_project.trackers
@available_statuses = Workflow.available_statuses(@project)
Eric Davis
Allow adding notes when moving issues...
r4178 @notes = params[:notes]
@notes ||= ''
Eric Davis
Refactor: Extract a new IssueMovesController from IssuesController....
r3822 end
def extract_changed_attributes_for_move(params)
changed_attributes = {}
Eric Davis
Allow changing the Priority when moving issues....
r4177 [:assigned_to_id, :status_id, :start_date, :due_date, :priority_id].each do |valid_attribute|
Eric Davis
Refactor: Extract a new IssueMovesController from IssuesController....
r3822 unless params[valid_attribute].blank?
changed_attributes[valid_attribute] = (params[valid_attribute] == 'none' ? nil : params[valid_attribute])
end
end
changed_attributes
end
end