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
<% 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 %>
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