# Bulk edit issues
def bulk_edit_issues
if request.post?
- status = IssueStatus.find_by_id(params[:status_id])
- priority = Enumeration.find_by_id(params[:priority_id])
- assigned_to = User.find_by_id(params[:assigned_to_id])
- category = @project.issue_categories.find_by_id(params[:category_id])
- fixed_version = @project.versions.find_by_id(params[:fixed_version_id])
+ status = params[:status_id].blank? ? nil : IssueStatus.find_by_id(params[:status_id])
+ priority = params[:priority_id].blank? ? nil : Enumeration.find_by_id(params[:priority_id])
+ assigned_to = params[:assigned_to_id].blank? ? nil : User.find_by_id(params[:assigned_to_id])
+ category = params[:category_id].blank? ? nil : @project.issue_categories.find_by_id(params[:category_id])
+ fixed_version = params[:fixed_version_id].blank? ? nil : @project.versions.find_by_id(params[:fixed_version_id])
issues = @project.issues.find_all_by_id(params[:issue_ids])
unsaved_issue_ids = []
issues.each do |issue|
</p>
<p>
<label><%= l(:field_assigned_to) %>:
-<%= select_tag('assigned_to_id', content_tag('option', l(:label_no_change_option)) +
+<%= select_tag('assigned_to_id', content_tag('option', l(:label_no_change_option), :value => '') +
content_tag('option', l(:label_nobody), :value => 'none') +
options_from_collection_for_select(@project.assignable_users, :id, :name)) %></label>
<label><%= l(:field_fixed_version) %>:
class ProjectsController; def rescue_action(e) raise e end; end
class ProjectsControllerTest < Test::Unit::TestCase
- fixtures :projects, :users, :roles, :enabled_modules
+ fixtures :projects, :users, :roles, :enabled_modules, :enumerations
def setup
@controller = ProjectsController.new
def test_bulk_edit_issues
@request.session[:user_id] = 2
# update issues priority
- post :bulk_edit_issues, :id => 1, :issue_ids => [1, 2], :priority_id => 7, :notes => "Bulk editing"
+ post :bulk_edit_issues, :id => 1, :issue_ids => [1, 2], :priority_id => 7, :notes => 'Bulk editing', :assigned_to_id => ''
assert_response 302
# check that the issues were updated
assert_equal [7, 7], Issue.find_all_by_id([1, 2]).collect {|i| i.priority.id}
- assert_equal "Bulk editing", Issue.find(1).journals.last.notes
+ assert_equal 'Bulk editing', Issue.find(1).journals.find(:first, :order => 'created_on DESC').notes
end
\r
def test_list_news\r