@@ -70,12 +70,10 class EnumerationsController < ApplicationController | |||
|
70 | 70 | @enumeration.destroy |
|
71 | 71 | redirect_to enumerations_path |
|
72 | 72 | return |
|
73 | elsif params[:reassign_to_id] | |
|
74 | if reassign_to = @enumeration.class.find_by_id(params[:reassign_to_id]) | |
|
75 | @enumeration.destroy(reassign_to) | |
|
76 | redirect_to enumerations_path | |
|
77 | return | |
|
78 | end | |
|
73 | elsif params[:reassign_to_id].present? && (reassign_to = @enumeration.class.find_by_id(params[:reassign_to_id].to_i)) | |
|
74 | @enumeration.destroy(reassign_to) | |
|
75 | redirect_to enumerations_path | |
|
76 | return | |
|
79 | 77 | end |
|
80 | 78 | @enumerations = @enumeration.class.system.all - [@enumeration] |
|
81 | 79 | end |
@@ -4,7 +4,7 | |||
|
4 | 4 | <div class="box"> |
|
5 | 5 | <p><strong><%= l(:text_enumeration_destroy_question, @enumeration.objects_count) %></strong></p> |
|
6 | 6 | <p><label for='reassign_to_id'><%= l(:text_enumeration_category_reassign_to) %></label> |
|
7 | <%= select_tag 'reassign_to_id', (content_tag('option', "--- #{l(:actionview_instancetag_blank_option)} ---") + options_from_collection_for_select(@enumerations, 'id', 'name')) %></p> | |
|
7 | <%= select_tag 'reassign_to_id', (content_tag('option', "--- #{l(:actionview_instancetag_blank_option)} ---", :value => '') + options_from_collection_for_select(@enumerations, 'id', 'name')) %></p> | |
|
8 | 8 | </div> |
|
9 | 9 | |
|
10 | 10 | <%= submit_tag l(:button_apply) %> |
@@ -126,4 +126,11 class EnumerationsControllerTest < ActionController::TestCase | |||
|
126 | 126 | # check that the issue was reassign |
|
127 | 127 | assert_equal 6, issue.reload.priority_id |
|
128 | 128 | end |
|
129 | ||
|
130 | def test_destroy_enumeration_in_use_with_blank_reassignment | |
|
131 | assert_no_difference 'IssuePriority.count' do | |
|
132 | delete :destroy, :id => 4, :reassign_to_id => '' | |
|
133 | end | |
|
134 | assert_response :success | |
|
135 | end | |
|
129 | 136 | end |
General Comments 0
You need to be logged in to leave comments.
Login now