diff options
-rw-r--r-- | app/controllers/groups_controller.rb | 6 | ||||
-rw-r--r-- | app/views/groups/new.html.erb | 5 | ||||
-rw-r--r-- | test/functional/groups_controller_test.rb | 7 |
3 files changed, 15 insertions, 3 deletions
diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb index db56eff96..76b891a44 100644 --- a/app/controllers/groups_controller.rb +++ b/app/controllers/groups_controller.rb @@ -67,8 +67,10 @@ class GroupsController < ApplicationController respond_to do |format| if @group.save - flash[:notice] = l(:notice_successful_create) - format.html { redirect_to(groups_path) } + format.html { + flash[:notice] = l(:notice_successful_create) + redirect_to(params[:continue] ? new_group_path : groups_path) + } format.xml { render :xml => @group, :status => :created, :location => @group } else format.html { render :action => "new" } diff --git a/app/views/groups/new.html.erb b/app/views/groups/new.html.erb index 469fc9b14..e983102af 100644 --- a/app/views/groups/new.html.erb +++ b/app/views/groups/new.html.erb @@ -2,5 +2,8 @@ <% form_for(@group, :builder => TabularFormBuilder, :lang => current_language) do |f| %> <%= render :partial => 'form', :locals => { :f => f } %> -<p><%= f.submit l(:button_create) %></p> +<p> + <%= f.submit l(:button_create) %> + <%= f.submit l(:button_create_and_continue), :name => 'continue' %> +</p> <% end %> diff --git a/test/functional/groups_controller_test.rb b/test/functional/groups_controller_test.rb index f45dfc456..2d84f3e4b 100644 --- a/test/functional/groups_controller_test.rb +++ b/test/functional/groups_controller_test.rb @@ -57,6 +57,13 @@ class GroupsControllerTest < ActionController::TestCase assert_redirected_to '/groups' end + def test_create_and_continue + assert_difference 'Group.count' do + post :create, :group => {:lastname => 'New group'}, :continue => 'Create and continue' + end + assert_redirected_to '/groups/new' + end + def test_edit get :edit, :id => 10 assert_response :success |