]> source.dussan.org Git - redmine.git/commitdiff
Adds a 'Move and follow' button on Move/Copy view to be redirected to the created...
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 15 Nov 2009 14:31:19 +0000 (14:31 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 15 Nov 2009 14:31:19 +0000 (14:31 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3063 e93f8b46-1217-0410-a6f0-8f06a7374b81

38 files changed:
app/controllers/issues_controller.rb
app/views/issues/move.rhtml
config/locales/bg.yml
config/locales/bs.yml
config/locales/ca.yml
config/locales/cs.yml
config/locales/da.yml
config/locales/de.yml
config/locales/el.yml
config/locales/en.yml
config/locales/es.yml
config/locales/fi.yml
config/locales/fr.yml
config/locales/gl.yml
config/locales/he.yml
config/locales/hu.yml
config/locales/it.yml
config/locales/ja.yml
config/locales/ko.yml
config/locales/lt.yml
config/locales/nl.yml
config/locales/no.yml
config/locales/pl.yml
config/locales/pt-BR.yml
config/locales/pt.yml
config/locales/ro.yml
config/locales/ru.yml
config/locales/sk.yml
config/locales/sl.yml
config/locales/sr.yml
config/locales/sv.yml
config/locales/th.yml
config/locales/tr.yml
config/locales/uk.yml
config/locales/vi.yml
config/locales/zh-TW.yml
config/locales/zh.yml
test/functional/issues_controller_test.rb

index a4f3de3d1f29345f0b2acf0b30f1769e385aa9a3..2fa465f4ea3b61d810cf90e063676db89c214edc 100644 (file)
@@ -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
-      redirect_to :controller => 'issues', :action => 'index', :project_id => @project
+      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?
index b0602f681befc6784c5bf9dd25c38af03b80cf80..0d4717f53424985bb916c0052c8f46c085f5126f 100644 (file)
@@ -25,5 +25,6 @@
 <%= check_box_tag "copy_options[copy]", "1" %></p>
 </div>
 
-<%= submit_tag l(:button_move) %>
+<%= submit_tag l(:button_move) %> 
+<%= submit_tag l(:button_move_and_follow), :name => 'follow' %>
 <% end %>
index 56a14ad5bb8b87763b2720a9805d1cc12c858917..69662dbab17d69dc3b0c5305f1bc012451e71fff 100644 (file)
@@ -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
index b23b2bbe237709ff0d7e7eb8cd6198c28837a5f1..716df4385f91d00c730d598494f40cc677634895 100644 (file)
@@ -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
index a7903ade8cf082f922861595188067bfa6835aa4..966df9a8fff357449580dc07b44cca139ee4409d 100644 (file)
@@ -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
index d65895ee30a1714ac28683581b0132a474d4c108..c1533f62bc3b0557353a1cc08391c58e9a86d077 100644 (file)
@@ -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
index bb3a14ced8012f76a001b8c0d84c7a896ec92c97..4d433f44ca0101301bd42f61798fca8cae11af50 100644 (file)
@@ -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
index 520284e9f88f59e00a96263cc3fdecbd9a1d76e1..425bcb575abd2fec078ad9155c70b2e231e80c80 100644 (file)
@@ -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
index a54952dfaa7b16c3d265aa814164a21dafc64c59..032fa1cacdbe188a921f07bdf7e85013bdf5f511 100644 (file)
@@ -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
index 574ee9db0173ed07e486f9d97bd6e7932f6b0076..5bd70a420d81bf4bea8d557976b68db43a8b4287 100644 (file)
@@ -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
index 8776faa3b401e8f681c66578b9d1ce6fa05fa340..d03088d5c67f29d1c8602b7b55ba39b98da61408 100644 (file)
@@ -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
index ab677f81b4350cbc27671857dc0f5edc988b25d4..acdee65a074cfb21eb536adb94258c0ffb6098c6 100644 (file)
@@ -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
index 4d39724036be5223e7b6a31b5867acd6c30a7712..aaa858af588e1ea2cd3f6f32aa753cf148448c8e 100644 (file)
@@ -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
index 85b59e8d2e49d69b3352b34920b91f4ba4da049a..e6f260ae660041e2be638c0b8ed0293218acac72 100644 (file)
@@ -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
index f344e81ccd98602ae14ab53d45e51a9998a95ada..16d6800df9cfdcd17b77916be4386da9c91202a8 100644 (file)
@@ -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
index f8e0f130ef754b236e096572803c72c969434d6c..1c9f7f0cf7caa720370764b082f625534552d40b 100644 (file)
   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
index 06fd50c99663fbbc448d4e23c5edb6bd52ae4ebe..74132a60a86820b8effc9a109bf6836f6f0e8091 100644 (file)
@@ -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
index 99f8a4ab675caf30c877b8d805a397fa4231c1d9..1cdb14f8ee3a1be38f8d641785dfbd5eaf21ed2c 100644 (file)
@@ -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
index be3b8719e2f81e058f252bb1a4604dd3e93587c6..a5b08607d2f8cd1fcc41c1a9ded7c72e425958a1 100644 (file)
@@ -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
index 021391620a13b0556ddad1c47de99b15a3f6d915..67e65a57004d4e7e57a50fc8072a305b6b2ef580 100644 (file)
@@ -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
index ae5107d551281acf19e77075542a1a4ca6d971ad..191738fd03394e761c3f3277a2079405a11edb17 100644 (file)
@@ -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
index 39a9ac7f00307314005dd2fd6f8d63eb4a088312..6fa2be0fe49f5e48ee8060991c9e41640713766c 100644 (file)
   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
index e5690967cf89b693c63bc6fa29a0cbbd96f5ace7..104a568a8a86d033da445261c14d55ca7ef93ef3 100644 (file)
@@ -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
index 1a90ded4d3bb8986814dd2625d6eeb73d7efd411..10d43a66c5b55db53c18aab137e54692f4f008bb 100644 (file)
@@ -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
index 3f4462794a7eff1e31702f7c0ef07a683c035785..c0133116c583f8dcf1d2d6f10351891173e9daeb 100644 (file)
@@ -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
index 9f0cc8763314fc0ed4b1430534e0ac2d86e4e531..9a97febd5694d0c9428c3251543166d2df20559f 100644 (file)
@@ -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
index a331afc0d1170b36216d6275986d7aeac120652a..84f06e8fb1d9451142e217f92ffe2650b2d5e33c 100644 (file)
@@ -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
index b715533fbd15129d0fda45ed861cb68bbd4cbb79..8f79cb3674cfd9a51c7289570974d839f0147596 100644 (file)
@@ -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
index a1d142cd2899b13cf72f9b939804551eb01367af..9ebcb6c401d46d3cdfadf426d92389d89bfc5f38 100644 (file)
@@ -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
index ff7bb91785609276c7dbca15e7578325a7205aec..dbd0c316e05167fc0aeb9342bdf8d6e4baccfece 100644 (file)
   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
index 3a2f82e8e2ed4a8bbc729bf65ae31ab7f8d0941b..807db8db4d42fedd61c066c0ef751dd96a8faa1d 100644 (file)
@@ -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
index 890b10e016ec1fc21ec8cfeff96ee17047ce2f4e..3ca9c46f91bd69290515ad71be71886dbaaa124d 100644 (file)
@@ -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
index a0f1977d927a1bedc43679a82a75700b9c54ff78..01e2843915efa5ad30d6ccaef1f0709af0a743a6 100644 (file)
@@ -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
index 4307c91a0be03641cd3b69313dede422f1e91a1a..f7f2a66fc9bc094268378916a9b36b3e87400dd8 100644 (file)
@@ -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
index cdd04a4f564d01bdb1717ccb1c41ff7f05e95f77..b12cba75b0b6debc9ccda607fcd1bcf55d965d63 100644 (file)
@@ -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
index 88f4f5cd272af8589fa054c21b7fbab2c5c9c9f7..494e5c808ed164a734e0630217f4767d0bd03279 100644 (file)
   enumeration_doc_categories: 文件分類
   enumeration_activities: 活動 (時間追蹤)
   enumeration_system_activity: 系統活動
+  button_move_and_follow: Move and follow
index 29b7cbce345c43844fa5bcb4964d64a7fcdea7f1..f1c772fc11ed70b4a17e7c63fa8d28040ca04207 100644 (file)
@@ -862,3 +862,4 @@ zh:
   enumeration_doc_categories: 文档类别
   enumeration_activities: 活动(时间跟踪)
   enumeration_system_activity: 系统活动
+  button_move_and_follow: Move and follow
index 1cff860b497daa5727673cea2a4ea0518aee0bf7..75da3c0c3d0ffe2a7cb0a9c59c30f4ff9f8ef5c0 100644 (file)
@@ -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
@@ -997,6 +1003,13 @@ class IssuesControllerTest < ActionController::TestCase
     end
     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