Patch by Mizuki ISHIKAWA. git-svn-id: http://svn.redmine.org/redmine/trunk@18054 e93f8b46-1217-0410-a6f0-8f06a7374b81tags/4.1.0
@@ -48,7 +48,11 @@ class CustomFieldsController < ApplicationController | |||
if @custom_field.save | |||
flash[:notice] = l(:notice_successful_create) | |||
call_hook(:controller_custom_fields_new_after_save, :params => params, :custom_field => @custom_field) | |||
redirect_to edit_custom_field_path(@custom_field) | |||
if params[:continue] | |||
redirect_to new_custom_field_path({:type => @custom_field.type}) | |||
else | |||
redirect_to edit_custom_field_path(@custom_field) | |||
end | |||
else | |||
render :action => 'new' | |||
end |
@@ -20,7 +20,14 @@ | |||
<%= call_hook(:view_custom_fields_form_upper_box, :custom_field => @custom_field, :form => f) %> | |||
</div> | |||
<p><%= submit_tag l(:button_save) %></p> | |||
<p> | |||
<% if @custom_field.new_record? %> | |||
<%= submit_tag l(:button_create) %> | |||
<%= submit_tag l(:button_create_and_continue), :name => 'continue' %> | |||
<% else %> | |||
<%= submit_tag l(:button_save) %> | |||
<% end %> | |||
</p> | |||
</div> | |||
<div class="splitcontentright"> |
@@ -256,6 +256,20 @@ class CustomFieldsControllerTest < Redmine::ControllerTest | |||
assert_equal [1, 3], field.projects.map(&:id).sort | |||
end | |||
def test_create_with_continue_params | |||
assert_difference 'CustomField.count' do | |||
post :create, :params => { | |||
:type => 'IssueCustomField', | |||
:continue => 'Create and Continue', | |||
:custom_field => { | |||
:name => 'foo', | |||
:field_format => 'string' | |||
} | |||
} | |||
end | |||
assert_redirected_to '/custom_fields/new?type=IssueCustomField' | |||
end | |||
def test_create_with_failure | |||
assert_no_difference 'CustomField.count' do | |||
post :create, :params => { |