diff options
-rw-r--r-- | app/controllers/custom_fields_controller.rb | 6 | ||||
-rw-r--r-- | app/views/custom_fields/_form.html.erb | 9 | ||||
-rw-r--r-- | test/functional/custom_fields_controller_test.rb | 14 |
3 files changed, 27 insertions, 2 deletions
diff --git a/app/controllers/custom_fields_controller.rb b/app/controllers/custom_fields_controller.rb index ebd4e9198..7f7beed64 100644 --- a/app/controllers/custom_fields_controller.rb +++ b/app/controllers/custom_fields_controller.rb @@ -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 diff --git a/app/views/custom_fields/_form.html.erb b/app/views/custom_fields/_form.html.erb index 140738505..cac457ce2 100644 --- a/app/views/custom_fields/_form.html.erb +++ b/app/views/custom_fields/_form.html.erb @@ -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"> diff --git a/test/functional/custom_fields_controller_test.rb b/test/functional/custom_fields_controller_test.rb index c243902e5..e9c5bdf0b 100644 --- a/test/functional/custom_fields_controller_test.rb +++ b/test/functional/custom_fields_controller_test.rb @@ -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 => { |