git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11854 e93f8b46-1217-0410-a6f0-8f06a7374b81tags/2.4.0
@@ -70,12 +70,10 @@ class EnumerationsController < ApplicationController | |||
@enumeration.destroy | |||
redirect_to enumerations_path | |||
return | |||
elsif params[:reassign_to_id] | |||
if reassign_to = @enumeration.class.find_by_id(params[:reassign_to_id]) | |||
@enumeration.destroy(reassign_to) | |||
redirect_to enumerations_path | |||
return | |||
end | |||
elsif params[:reassign_to_id].present? && (reassign_to = @enumeration.class.find_by_id(params[:reassign_to_id].to_i)) | |||
@enumeration.destroy(reassign_to) | |||
redirect_to enumerations_path | |||
return | |||
end | |||
@enumerations = @enumeration.class.system.all - [@enumeration] | |||
end |
@@ -4,7 +4,7 @@ | |||
<div class="box"> | |||
<p><strong><%= l(:text_enumeration_destroy_question, @enumeration.objects_count) %></strong></p> | |||
<p><label for='reassign_to_id'><%= l(:text_enumeration_category_reassign_to) %></label> | |||
<%= select_tag 'reassign_to_id', (content_tag('option', "--- #{l(:actionview_instancetag_blank_option)} ---") + options_from_collection_for_select(@enumerations, 'id', 'name')) %></p> | |||
<%= select_tag 'reassign_to_id', (content_tag('option', "--- #{l(:actionview_instancetag_blank_option)} ---", :value => '') + options_from_collection_for_select(@enumerations, 'id', 'name')) %></p> | |||
</div> | |||
<%= submit_tag l(:button_apply) %> |
@@ -126,4 +126,11 @@ class EnumerationsControllerTest < ActionController::TestCase | |||
# check that the issue was reassign | |||
assert_equal 6, issue.reload.priority_id | |||
end | |||
def test_destroy_enumeration_in_use_with_blank_reassignment | |||
assert_no_difference 'IssuePriority.count' do | |||
delete :destroy, :id => 4, :reassign_to_id => '' | |||
end | |||
assert_response :success | |||
end | |||
end |