summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2011-07-21 15:51:58 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2011-07-21 15:51:58 +0000
commitf595197ecfd57e7c3a61564d7409dfed88a50eff (patch)
tree96dadbfac3196f7d52be7de63f604abdd113a0cc
parented23149a6c1849e52c5e085a42321295d639fa55 (diff)
downloadredmine-f595197ecfd57e7c3a61564d7409dfed88a50eff.tar.gz
redmine-f595197ecfd57e7c3a61564d7409dfed88a50eff.zip
Adds a 'Create and continue' button on project form.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@6303 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--app/controllers/projects_controller.rb5
-rw-r--r--app/views/projects/new.html.erb3
-rw-r--r--test/functional/projects_controller_test.rb7
3 files changed, 13 insertions, 2 deletions
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index 4b750dc0e..c8f26a96c 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -87,7 +87,10 @@ class ProjectsController < ApplicationController
respond_to do |format|
format.html {
flash[:notice] = l(:notice_successful_create)
- redirect_to :controller => 'projects', :action => 'settings', :id => @project
+ redirect_to(params[:continue] ?
+ {:controller => 'projects', :action => 'new', :project => {:parent_id => @project.parent_id}.reject {|k,v| v.nil?}} :
+ {:controller => 'projects', :action => 'settings', :id => @project}
+ )
}
format.api { render :action => 'show', :status => :created, :location => url_for(:controller => 'projects', :action => 'show', :id => @project.id) }
end
diff --git a/app/views/projects/new.html.erb b/app/views/projects/new.html.erb
index 2642241bf..a10cf15a9 100644
--- a/app/views/projects/new.html.erb
+++ b/app/views/projects/new.html.erb
@@ -2,6 +2,7 @@
<% labelled_tabular_form_for :project, @project, :url => { :action => "create" } do |f| %>
<%= render :partial => 'form', :locals => { :f => f } %>
-<%= submit_tag l(:button_save) %>
+<%= submit_tag l(:button_create) %>
+<%= submit_tag l(:button_create_and_continue), :name => 'continue' %>
<%= javascript_tag "Form.Element.focus('project_name');" %>
<% end %>
diff --git a/test/functional/projects_controller_test.rb b/test/functional/projects_controller_test.rb
index bc0de15a0..bdff70c22 100644
--- a/test/functional/projects_controller_test.rb
+++ b/test/functional/projects_controller_test.rb
@@ -186,6 +186,13 @@ class ProjectsControllerTest < ActionController::TestCase
assert_kind_of Project, project
assert_equal Project.find(1), project.parent
end
+
+ should "continue" do
+ assert_difference 'Project.count' do
+ post :create, :project => {:name => "blog", :identifier => "blog"}, :continue => 'Create and continue'
+ end
+ assert_redirected_to '/projects/new?'
+ end
end
context "by non-admin user with add_project permission" do