Allow adding notes when moving issues

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4292 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Eric Davis 2010-10-25 18:44:46 +00:00
parent 22e3cba0b7
commit 397222f198
3 changed files with 21 additions and 1 deletions

View File

@ -18,6 +18,7 @@ class IssueMovesController < ApplicationController
@issues.each do |issue|
issue.reload
issue.init_journal(User.current)
issue.current_journal.notes = @notes if @notes.present?
call_hook(:controller_issues_move_before_save, { :params => params, :issue => issue, :target_project => @target_project, :copy => !!@copy })
if r = issue.move_to_project(@target_project, new_tracker, {:copy => @copy, :attributes => extract_changed_attributes_for_move(params)})
moved_issues << r
@ -50,6 +51,8 @@ class IssueMovesController < ApplicationController
@target_project ||= @project
@trackers = @target_project.trackers
@available_statuses = Workflow.available_statuses(@project)
@notes = params[:notes]
@notes ||= ''
end
def extract_changed_attributes_for_move(params)

View File

@ -48,6 +48,11 @@
<%= text_field_tag 'due_date', '', :size => 10 %><%= calendar_for('due_date') %>
</p>
<fieldset><legend><%= l(:field_notes) %></legend>
<%= text_area_tag 'notes', @notes, :cols => 60, :rows => 10, :class => 'wiki-edit' %>
<%= wikitoolbar_for 'notes' %>
</fieldset>
<%= call_hook(:view_issues_move_bottom, :issues => @issues, :target_project => @target_project, :copy => !!@copy) %>
</div>

View File

@ -41,8 +41,11 @@ class IssueMovesControllerTest < ActionController::TestCase
end
context "#create via bulk move" do
should "allow changing the issue priority" do
setup do
@request.session[:user_id] = 2
end
should "allow changing the issue priority" do
post :create, :ids => [1, 2], :priority_id => 6
assert_redirected_to :controller => 'issues', :action => 'index', :project_id => 'ecookbook'
@ -50,6 +53,15 @@ class IssueMovesControllerTest < ActionController::TestCase
assert_equal 6, Issue.find(2).priority_id
end
should "allow adding a note when moving" do
post :create, :ids => [1, 2], :notes => 'Moving two issues'
assert_redirected_to :controller => 'issues', :action => 'index', :project_id => 'ecookbook'
assert_equal 'Moving two issues', Issue.find(1).journals.last.notes
assert_equal 'Moving two issues', Issue.find(2).journals.last.notes
end
end