Feature #31159 ยป feature-31159.patch
| app/controllers/custom_fields_controller.rb | ||
|---|---|---|
|
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
|
||
| app/views/custom_fields/_form.html.erb | ||
|---|---|---|
|
<%= 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">
|
||
| test/functional/custom_fields_controller_test.rb | ||
|---|---|---|
|
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 => {
|
||