瀏覽代碼

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
tags/1.3.0
Jean-Philippe Lang 13 年之前
父節點
當前提交
82f5831545
共有 3 個檔案被更改,包括 15 行新增3 行删除
  1. 4
    2
      app/controllers/groups_controller.rb
  2. 4
    1
      app/views/groups/new.html.erb
  3. 7
    0
      test/functional/groups_controller_test.rb

+ 4
- 2
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" }

+ 4
- 1
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 %>

+ 7
- 0
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

Loading…
取消
儲存