Feature #31159 ยป feature-31159.patch
| app/controllers/custom_fields_controller.rb | ||
|---|---|---|
| 48 | 48 |
if @custom_field.save |
| 49 | 49 |
flash[:notice] = l(:notice_successful_create) |
| 50 | 50 |
call_hook(:controller_custom_fields_new_after_save, :params => params, :custom_field => @custom_field) |
| 51 |
redirect_to edit_custom_field_path(@custom_field) |
|
| 51 |
if params[:continue] |
|
| 52 |
redirect_to new_custom_field_path({:type => @custom_field.type})
|
|
| 53 |
else |
|
| 54 |
redirect_to edit_custom_field_path(@custom_field) |
|
| 55 |
end |
|
| 52 | 56 |
else |
| 53 | 57 |
render :action => 'new' |
| 54 | 58 |
end |
| app/views/custom_fields/_form.html.erb | ||
|---|---|---|
| 20 | 20 | |
| 21 | 21 |
<%= call_hook(:view_custom_fields_form_upper_box, :custom_field => @custom_field, :form => f) %> |
| 22 | 22 |
</div> |
| 23 |
<p><%= submit_tag l(:button_save) %></p> |
|
| 23 |
<p> |
|
| 24 |
<% if @custom_field.new_record? %> |
|
| 25 |
<%= submit_tag l(:button_create) %> |
|
| 26 |
<%= submit_tag l(:button_create_and_continue), :name => 'continue' %> |
|
| 27 |
<% else %> |
|
| 28 |
<%= submit_tag l(:button_save) %> |
|
| 29 |
<% end %> |
|
| 30 |
</p> |
|
| 24 | 31 |
</div> |
| 25 | 32 | |
| 26 | 33 |
<div class="splitcontentright"> |
| test/functional/custom_fields_controller_test.rb | ||
|---|---|---|
| 256 | 256 |
assert_equal [1, 3], field.projects.map(&:id).sort |
| 257 | 257 |
end |
| 258 | 258 | |
| 259 |
def test_create_with_continue_params |
|
| 260 |
assert_difference 'CustomField.count' do |
|
| 261 |
post :create, :params => {
|
|
| 262 |
:type => 'IssueCustomField', |
|
| 263 |
:continue => 'Create and Continue', |
|
| 264 |
:custom_field => {
|
|
| 265 |
:name => 'foo', |
|
| 266 |
:field_format => 'string' |
|
| 267 |
} |
|
| 268 |
} |
|
| 269 |
end |
|
| 270 |
assert_redirected_to '/custom_fields/new?type=IssueCustomField' |
|
| 271 |
end |
|
| 272 | ||
| 259 | 273 |
def test_create_with_failure |
| 260 | 274 |
assert_no_difference 'CustomField.count' do |
| 261 | 275 |
post :create, :params => {
|