]> source.dussan.org Git - redmine.git/commitdiff
Redirect to project settings after copying a project. #6443
authorEric Davis <edavis@littlestreamsoftware.com>
Sun, 26 Sep 2010 18:04:54 +0000 (18:04 +0000)
committerEric Davis <edavis@littlestreamsoftware.com>
Sun, 26 Sep 2010 18:04:54 +0000 (18:04 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4185 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/controllers/projects_controller.rb
test/functional/projects_controller_test.rb

index f1634932915b104259f1d46c214f01c4a42e8287..c3efbfd9f2dce5092ff12545b8e977a6cda827ff 100644 (file)
@@ -125,13 +125,13 @@ class ProjectsController < ApplicationController
         if validate_parent_id && @project.copy(@source_project, :only => params[:only])
           @project.set_allowed_parent!(params[:project]['parent_id']) if params[:project].has_key?('parent_id')
           flash[:notice] = l(:notice_successful_create)
-          redirect_to :controller => 'admin', :action => 'projects'
+          redirect_to :controller => 'projects', :action => 'settings'
         elsif !@project.new_record?
           # Project was created
           # But some objects were not copied due to validation failures
           # (eg. issues from disabled trackers)
           # TODO: inform about that
-          redirect_to :controller => 'admin', :action => 'projects'
+          redirect_to :controller => 'projects', :action => 'settings'
         end
       end
     end
index 636cb17519ef95b0470154c38c72fc67864a3b34..8a9bbe6d599abf55d70c81a575c607a2d80e93dc 100644 (file)
@@ -389,6 +389,17 @@ class ProjectsControllerTest < ActionController::TestCase
     assert_redirected_to :controller => 'admin', :action => 'projects'
   end
 
+  context "POST :copy" do
+    should "TODO: test the rest of the method"
+
+    should "redirect to the project settings when successful" do
+      @request.session[:user_id] = 1 # admin
+      post :copy, :id => 1, :project => {:name => 'Copy', :identifier => 'unique-copy'}
+      assert_response :redirect
+      assert_redirected_to :controller => 'projects', :action => 'settings'
+    end
+  end
+
   def test_jump_should_redirect_to_active_tab
     get :show, :id => 1, :jump => 'issues'
     assert_redirected_to 'projects/ecookbook/issues'