@@ -20,7 +20,7 class IssuesController < ApplicationController | |||
|
20 | 20 | default_search_scope :issues |
|
21 | 21 | |
|
22 | 22 | before_filter :find_issue, :only => [:show, :edit, :update, :reply] |
|
23 | before_filter :find_issues, :only => [:bulk_edit, :move, :destroy] | |
|
23 | before_filter :find_issues, :only => [:bulk_edit, :move, :perform_move, :destroy] | |
|
24 | 24 | before_filter :find_project, :only => [:new, :create, :update_form, :preview, :auto_complete] |
|
25 | 25 | before_filter :authorize, :except => [:index, :changes, :preview, :context_menu] |
|
26 | 26 | before_filter :find_optional_project, :only => [:index, :changes] |
@@ -287,6 +287,11 class IssuesController < ApplicationController | |||
|
287 | 287 | end |
|
288 | 288 | render :layout => false if request.xhr? |
|
289 | 289 | end |
|
290 | ||
|
291 | # TODO: more descriptive name? move to separate controller like IssueMovesController? | |
|
292 | def perform_move | |
|
293 | move | |
|
294 | end | |
|
290 | 295 | |
|
291 | 296 | def destroy |
|
292 | 297 | @hours = TimeEntry.sum(:hours, :conditions => ['issue_id IN (?)', @issues]).to_f |
@@ -6,7 +6,7 | |||
|
6 | 6 | <% end -%> |
|
7 | 7 | </ul> |
|
8 | 8 | |
|
9 | <% form_tag({}, :id => 'move_form') do %> | |
|
9 | <% form_tag({:action => 'perform_move'}, :id => 'move_form') do %> | |
|
10 | 10 | <%= @issues.collect {|i| hidden_field_tag('ids[]', i.id)}.join %> |
|
11 | 11 | |
|
12 | 12 | <div class="box tabular"> |
@@ -124,7 +124,7 ActionController::Routing::Routes.draw do |map| | |||
|
124 | 124 | issues_actions.connect 'projects/:project_id/issues/gantt', :controller => 'gantts', :action => 'show' |
|
125 | 125 | issues_actions.connect 'projects/:project_id/issues/calendar', :controller => 'calendars', :action => 'show' |
|
126 | 126 | issues_actions.connect 'issues/:id/quoted', :action => 'reply', :id => /\d+/ |
|
127 | issues_actions.connect 'issues/:id/:action', :action => /edit|move|destroy/, :id => /\d+/ | |
|
127 | issues_actions.connect 'issues/:id/:action', :action => /edit|perform_move|destroy/, :id => /\d+/ | |
|
128 | 128 | issues_actions.connect 'issues.:format', :action => 'create', :format => /xml/ |
|
129 | 129 | end |
|
130 | 130 | issues_routes.with_options :conditions => {:method => :put} do |issues_actions| |
@@ -69,7 +69,7 Redmine::AccessControl.map do |map| | |||
|
69 | 69 | map.permission :add_issue_notes, {:issues => [:edit, :update, :reply]} |
|
70 | 70 | map.permission :edit_issue_notes, {:journals => :edit}, :require => :loggedin |
|
71 | 71 | map.permission :edit_own_issue_notes, {:journals => :edit}, :require => :loggedin |
|
72 | map.permission :move_issues, {:issues => :move}, :require => :loggedin | |
|
72 | map.permission :move_issues, {:issues => [:move, :perform_move]}, :require => :loggedin | |
|
73 | 73 | map.permission :delete_issues, {:issues => :destroy}, :require => :member |
|
74 | 74 | # Queries |
|
75 | 75 | map.permission :manage_public_queries, {:queries => [:new, :edit, :destroy]}, :require => :member |
@@ -1038,22 +1038,22 class IssuesControllerTest < ActionController::TestCase | |||
|
1038 | 1038 | assert_redirected_to :controller => 'issues', :action => 'index', :project_id => Project.find(1).identifier |
|
1039 | 1039 | end |
|
1040 | 1040 | |
|
1041 | def test_move_one_issue_to_another_project | |
|
1041 | def test_perform_move_one_issue_to_another_project | |
|
1042 | 1042 | @request.session[:user_id] = 2 |
|
1043 | post :move, :id => 1, :new_project_id => 2, :tracker_id => '', :assigned_to_id => '', :status_id => '', :start_date => '', :due_date => '' | |
|
1043 | post :perform_move, :id => 1, :new_project_id => 2, :tracker_id => '', :assigned_to_id => '', :status_id => '', :start_date => '', :due_date => '' | |
|
1044 | 1044 | assert_redirected_to :action => 'index', :project_id => 'ecookbook' |
|
1045 | 1045 | assert_equal 2, Issue.find(1).project_id |
|
1046 | 1046 | end |
|
1047 | 1047 | |
|
1048 | def test_move_one_issue_to_another_project_should_follow_when_needed | |
|
1048 | def test_perform_move_one_issue_to_another_project_should_follow_when_needed | |
|
1049 | 1049 | @request.session[:user_id] = 2 |
|
1050 | post :move, :id => 1, :new_project_id => 2, :follow => '1' | |
|
1050 | post :perform_move, :id => 1, :new_project_id => 2, :follow => '1' | |
|
1051 | 1051 | assert_redirected_to '/issues/1' |
|
1052 | 1052 | end |
|
1053 | 1053 | |
|
1054 | def test_bulk_move_to_another_project | |
|
1054 | def test_bulk_perform_move_to_another_project | |
|
1055 | 1055 | @request.session[:user_id] = 2 |
|
1056 | post :move, :ids => [1, 2], :new_project_id => 2 | |
|
1056 | post :perform_move, :ids => [1, 2], :new_project_id => 2 | |
|
1057 | 1057 | assert_redirected_to :action => 'index', :project_id => 'ecookbook' |
|
1058 | 1058 | # Issues moved to project 2 |
|
1059 | 1059 | assert_equal 2, Issue.find(1).project_id |
@@ -1063,9 +1063,9 class IssuesControllerTest < ActionController::TestCase | |||
|
1063 | 1063 | assert_equal 2, Issue.find(2).tracker_id |
|
1064 | 1064 | end |
|
1065 | 1065 | |
|
1066 | def test_bulk_move_to_another_tracker | |
|
1066 | def test_bulk_perform_move_to_another_tracker | |
|
1067 | 1067 | @request.session[:user_id] = 2 |
|
1068 | post :move, :ids => [1, 2], :new_tracker_id => 2 | |
|
1068 | post :perform_move, :ids => [1, 2], :new_tracker_id => 2 | |
|
1069 | 1069 | assert_redirected_to :action => 'index', :project_id => 'ecookbook' |
|
1070 | 1070 | assert_equal 2, Issue.find(1).tracker_id |
|
1071 | 1071 | assert_equal 2, Issue.find(2).tracker_id |
@@ -1075,19 +1075,19 class IssuesControllerTest < ActionController::TestCase | |||
|
1075 | 1075 | @request.session[:user_id] = 2 |
|
1076 | 1076 | assert_difference 'Issue.count', 2 do |
|
1077 | 1077 | assert_no_difference 'Project.find(1).issues.count' do |
|
1078 | post :move, :ids => [1, 2], :new_project_id => 2, :copy_options => {:copy => '1'} | |
|
1078 | post :perform_move, :ids => [1, 2], :new_project_id => 2, :copy_options => {:copy => '1'} | |
|
1079 | 1079 | end |
|
1080 | 1080 | end |
|
1081 | 1081 | assert_redirected_to 'projects/ecookbook/issues' |
|
1082 | 1082 | end |
|
1083 | 1083 | |
|
1084 | context "#move via bulk copy" do | |
|
1084 | context "#perform_move via bulk copy" do | |
|
1085 | 1085 | should "allow not changing the issue's attributes" do |
|
1086 | 1086 | @request.session[:user_id] = 2 |
|
1087 | 1087 | issue_before_move = Issue.find(1) |
|
1088 | 1088 | assert_difference 'Issue.count', 1 do |
|
1089 | 1089 | assert_no_difference 'Project.find(1).issues.count' do |
|
1090 | post :move, :ids => [1], :new_project_id => 2, :copy_options => {:copy => '1'}, :new_tracker_id => '', :assigned_to_id => '', :status_id => '', :start_date => '', :due_date => '' | |
|
1090 | post :perform_move, :ids => [1], :new_project_id => 2, :copy_options => {:copy => '1'}, :new_tracker_id => '', :assigned_to_id => '', :status_id => '', :start_date => '', :due_date => '' | |
|
1091 | 1091 | end |
|
1092 | 1092 | end |
|
1093 | 1093 | issue_after_move = Issue.first(:order => 'id desc', :conditions => {:project_id => 2}) |
@@ -1104,7 +1104,7 class IssuesControllerTest < ActionController::TestCase | |||
|
1104 | 1104 | @request.session[:user_id] = 2 |
|
1105 | 1105 | assert_difference 'Issue.count', 2 do |
|
1106 | 1106 | assert_no_difference 'Project.find(1).issues.count' do |
|
1107 | post :move, :ids => [1, 2], :new_project_id => 2, :copy_options => {:copy => '1'}, :new_tracker_id => '', :assigned_to_id => 4, :status_id => 3, :start_date => '2009-12-01', :due_date => '2009-12-31' | |
|
1107 | post :perform_move, :ids => [1, 2], :new_project_id => 2, :copy_options => {:copy => '1'}, :new_tracker_id => '', :assigned_to_id => 4, :status_id => 3, :start_date => '2009-12-01', :due_date => '2009-12-31' | |
|
1108 | 1108 | end |
|
1109 | 1109 | end |
|
1110 | 1110 | |
@@ -1122,7 +1122,7 class IssuesControllerTest < ActionController::TestCase | |||
|
1122 | 1122 | |
|
1123 | 1123 | def test_copy_to_another_project_should_follow_when_needed |
|
1124 | 1124 | @request.session[:user_id] = 2 |
|
1125 | post :move, :ids => [1], :new_project_id => 2, :copy_options => {:copy => '1'}, :follow => '1' | |
|
1125 | post :perform_move, :ids => [1], :new_project_id => 2, :copy_options => {:copy => '1'}, :follow => '1' | |
|
1126 | 1126 | issue = Issue.first(:order => 'id DESC') |
|
1127 | 1127 | assert_redirected_to :controller => 'issues', :action => 'show', :id => issue |
|
1128 | 1128 | end |
@@ -86,7 +86,7 class RoutingTest < ActionController::IntegrationTest | |||
|
86 | 86 | should_route :get, "/projects/23/issues/64/copy", :controller => 'issues', :action => 'new', :project_id => '23', :copy_from => '64' |
|
87 | 87 | |
|
88 | 88 | should_route :get, "/issues/1/move", :controller => 'issues', :action => 'move', :id => '1' |
|
89 | should_route :post, "/issues/1/move", :controller => 'issues', :action => 'move', :id => '1' | |
|
89 | should_route :post, "/issues/1/perform_move", :controller => 'issues', :action => 'perform_move', :id => '1' | |
|
90 | 90 | |
|
91 | 91 | should_route :post, "/issues/1/quoted", :controller => 'issues', :action => 'reply', :id => '1' |
|
92 | 92 |
General Comments 0
You need to be logged in to leave comments.
Login now