Commit 98ec3c03 authored by jplang's avatar jplang
Browse files

Adds a 'Move and follow' button on Move/Copy view to be redirected to the...

Adds a 'Move and follow' button on Move/Copy view to be redirected to the created issue(s) rather than the source project issue list (#1847).

git-svn-id: https://svn.redmine.org/redmine/trunk@3063 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent b916a557
......@@ -299,9 +299,14 @@ class IssuesController < ApplicationController
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.init_journal(User.current)
unsaved_issue_ids << issue.id unless issue.move_to(@target_project, new_tracker, params[:copy_options])
if r = issue.move_to(@target_project, new_tracker, params[:copy_options])
moved_issues << r
else
unsaved_issue_ids << issue.id
end
end
if unsaved_issue_ids.empty?
flash[:notice] = l(:notice_successful_update) unless @issues.empty?
......@@ -310,7 +315,15 @@ class IssuesController < ApplicationController
:total => @issues.size,
:ids => '#' + unsaved_issue_ids.join(', #'))
end
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
render :layout => false if request.xhr?
......
......@@ -26,4 +26,5 @@
</div>
<%= submit_tag l(:button_move) %>
<%= submit_tag l(:button_move_and_follow), :name => 'follow' %>
<% end %>
......@@ -832,3 +832,4 @@ bg:
version_status_open: open
error_can_not_reopen_issue_on_closed_version: An issue assigned to a closed version can not be reopened
label_user_anonymous: Anonymous
button_move_and_follow: Move and follow
......@@ -856,3 +856,4 @@ bs:
version_status_open: open
error_can_not_reopen_issue_on_closed_version: An issue assigned to a closed version can not be reopened
label_user_anonymous: Anonymous
button_move_and_follow: Move and follow
......@@ -835,3 +835,4 @@ ca:
version_status_open: open
error_can_not_reopen_issue_on_closed_version: An issue assigned to a closed version can not be reopened
label_user_anonymous: Anonymous
button_move_and_follow: Move and follow
......@@ -838,3 +838,4 @@ cs:
version_status_open: open
error_can_not_reopen_issue_on_closed_version: An issue assigned to a closed version can not be reopened
label_user_anonymous: Anonymous
button_move_and_follow: Move and follow
......@@ -858,3 +858,4 @@ da:
version_status_open: open
error_can_not_reopen_issue_on_closed_version: An issue assigned to a closed version can not be reopened
label_user_anonymous: Anonymous
button_move_and_follow: Move and follow
......@@ -858,3 +858,4 @@ de:
version_status_open: open
error_can_not_reopen_issue_on_closed_version: An issue assigned to a closed version can not be reopened
label_user_anonymous: Anonymous
button_move_and_follow: Move and follow
......@@ -838,3 +838,4 @@ el:
version_status_open: open
error_can_not_reopen_issue_on_closed_version: An issue assigned to a closed version can not be reopened
label_user_anonymous: Anonymous
button_move_and_follow: Move and follow
......@@ -728,6 +728,7 @@ en:
button_list: List
button_view: View
button_move: Move
button_move_and_follow: Move and follow
button_back: Back
button_cancel: Cancel
button_activate: Activate
......
......@@ -879,3 +879,4 @@ es:
version_status_open: open
error_can_not_reopen_issue_on_closed_version: An issue assigned to a closed version can not be reopened
label_user_anonymous: Anonymous
button_move_and_follow: Move and follow
......@@ -868,3 +868,4 @@ fi:
version_status_open: open
error_can_not_reopen_issue_on_closed_version: An issue assigned to a closed version can not be reopened
label_user_anonymous: Anonymous
button_move_and_follow: Move and follow
......@@ -745,6 +745,7 @@ fr:
button_list: Lister
button_view: Voir
button_move: Déplacer
button_move_and_follow: Déplacer et suivre
button_back: Retour
button_cancel: Annuler
button_activate: Activer
......
......@@ -858,3 +858,4 @@ gl:
version_status_open: open
error_can_not_reopen_issue_on_closed_version: An issue assigned to a closed version can not be reopened
label_user_anonymous: Anonymous
button_move_and_follow: Move and follow
......@@ -842,3 +842,4 @@ he:
version_status_open: open
error_can_not_reopen_issue_on_closed_version: An issue assigned to a closed version can not be reopened
label_user_anonymous: Anonymous
button_move_and_follow: Move and follow
......@@ -863,3 +863,4 @@
version_status_open: open
error_can_not_reopen_issue_on_closed_version: An issue assigned to a closed version can not be reopened
label_user_anonymous: Anonymous
button_move_and_follow: Move and follow
......@@ -845,3 +845,4 @@ it:
version_status_open: open
error_can_not_reopen_issue_on_closed_version: An issue assigned to a closed version can not be reopened
label_user_anonymous: Anonymous
button_move_and_follow: Move and follow
......@@ -867,3 +867,4 @@ ja:
version_status_open: open
error_can_not_reopen_issue_on_closed_version: An issue assigned to a closed version can not be reopened
label_user_anonymous: Anonymous
button_move_and_follow: Move and follow
......@@ -898,3 +898,4 @@ ko:
version_status_open: open
error_can_not_reopen_issue_on_closed_version: An issue assigned to a closed version can not be reopened
label_user_anonymous: Anonymous
button_move_and_follow: Move and follow
......@@ -868,3 +868,4 @@ lt:
version_status_open: open
error_can_not_reopen_issue_on_closed_version: An issue assigned to a closed version can not be reopened
label_user_anonymous: Anonymous
button_move_and_follow: Move and follow
......@@ -820,3 +820,4 @@ nl:
version_status_open: open
error_can_not_reopen_issue_on_closed_version: An issue assigned to a closed version can not be reopened
label_user_anonymous: Anonymous
button_move_and_follow: Move and follow
......@@ -833,3 +833,4 @@
version_status_open: open
error_can_not_reopen_issue_on_closed_version: An issue assigned to a closed version can not be reopened
label_user_anonymous: Anonymous
button_move_and_follow: Move and follow
......@@ -861,3 +861,4 @@ pl:
version_status_open: open
error_can_not_reopen_issue_on_closed_version: An issue assigned to a closed version can not be reopened
label_user_anonymous: Anonymous
button_move_and_follow: Move and follow
......@@ -864,3 +864,4 @@ pt-BR:
version_status_open: aberto
error_can_not_reopen_issue_on_closed_version: Uma tarefa atribuída a uma versão fechada não pode ser reaberta
label_user_anonymous: Anônimo
button_move_and_follow: Move and follow
......@@ -850,3 +850,4 @@ pt:
version_status_open: open
error_can_not_reopen_issue_on_closed_version: An issue assigned to a closed version can not be reopened
label_user_anonymous: Anonymous
button_move_and_follow: Move and follow
......@@ -835,3 +835,4 @@ ro:
version_status_open: open
error_can_not_reopen_issue_on_closed_version: An issue assigned to a closed version can not be reopened
label_user_anonymous: Anonymous
button_move_and_follow: Move and follow
......@@ -946,3 +946,4 @@ ru:
version_status_open: открыт
error_can_not_reopen_issue_on_closed_version: Задача, назначенная к закрытой версии, не сможет быть открыта снова
label_user_anonymous: Аноним
button_move_and_follow: Move and follow
......@@ -837,3 +837,4 @@ sk:
version_status_open: open
error_can_not_reopen_issue_on_closed_version: An issue assigned to a closed version can not be reopened
label_user_anonymous: Anonymous
button_move_and_follow: Move and follow
......@@ -834,3 +834,4 @@ sl:
version_status_open: open
error_can_not_reopen_issue_on_closed_version: An issue assigned to a closed version can not be reopened
label_user_anonymous: Anonymous
button_move_and_follow: Move and follow
......@@ -853,3 +853,4 @@
version_status_open: open
error_can_not_reopen_issue_on_closed_version: An issue assigned to a closed version can not be reopened
label_user_anonymous: Anonymous
button_move_and_follow: Move and follow
......@@ -886,3 +886,4 @@ sv:
version_status_open: open
error_can_not_reopen_issue_on_closed_version: An issue assigned to a closed version can not be reopened
label_user_anonymous: Anonymous
button_move_and_follow: Move and follow
......@@ -835,3 +835,4 @@ th:
version_status_open: open
error_can_not_reopen_issue_on_closed_version: An issue assigned to a closed version can not be reopened
label_user_anonymous: Anonymous
button_move_and_follow: Move and follow
......@@ -865,3 +865,4 @@ tr:
version_status_open: open
error_can_not_reopen_issue_on_closed_version: An issue assigned to a closed version can not be reopened
label_user_anonymous: Anonymous
button_move_and_follow: Move and follow
......@@ -834,3 +834,4 @@ uk:
version_status_open: open
error_can_not_reopen_issue_on_closed_version: An issue assigned to a closed version can not be reopened
label_user_anonymous: Anonymous
button_move_and_follow: Move and follow
......@@ -897,3 +897,4 @@ vi:
version_status_open: open
error_can_not_reopen_issue_on_closed_version: An issue assigned to a closed version can not be reopened
label_user_anonymous: Anonymous
button_move_and_follow: Move and follow
......@@ -929,3 +929,4 @@
enumeration_doc_categories: 文件分類
enumeration_activities: 活動 (時間追蹤)
enumeration_system_activity: 系統活動
button_move_and_follow: Move and follow
......@@ -862,3 +862,4 @@ zh:
enumeration_doc_categories: 文档类别
enumeration_activities: 活动(时间跟踪)
enumeration_system_activity: 系统活动
button_move_and_follow: Move and follow
......@@ -968,6 +968,12 @@ class IssuesControllerTest < ActionController::TestCase
assert_equal 2, Issue.find(1).project_id
end
def test_move_one_issue_to_another_project_should_follow_when_needed
@request.session[:user_id] = 2
post :move, :id => 1, :new_project_id => 2, :follow => '1'
assert_redirected_to '/issues/1'
end
def test_bulk_move_to_another_project
@request.session[:user_id] = 2
post :move, :ids => [1, 2], :new_project_id => 2
......@@ -998,6 +1004,13 @@ class IssuesControllerTest < ActionController::TestCase
assert_redirected_to 'projects/ecookbook/issues'
end
def test_copy_to_another_project_should_follow_when_needed
@request.session[:user_id] = 2
post :move, :ids => [1], :new_project_id => 2, :copy_options => {:copy => '1'}, :follow => '1'
issue = Issue.first(:order => 'id DESC')
assert_redirected_to :controller => 'issues', :action => 'show', :id => issue
end
def test_context_menu_one_issue
@request.session[:user_id] = 2
get :context_menu, :ids => [1]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment