Adds 'Create and continue' button on the new group form.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@6304 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2011-07-21 15:55:50 +00:00
parent f595197ecf
commit 82f5831545
3 changed files with 15 additions and 3 deletions

View File

@ -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" }

View File

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

View File

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