@@ -206,17 +206,17 class IssuesController < ApplicationController | |||||
206 | if request.post? |
|
206 | if request.post? | |
207 | status = params[:status_id].blank? ? nil : IssueStatus.find_by_id(params[:status_id]) |
|
207 | status = params[:status_id].blank? ? nil : IssueStatus.find_by_id(params[:status_id]) | |
208 | priority = params[:priority_id].blank? ? nil : Enumeration.find_by_id(params[:priority_id]) |
|
208 | priority = params[:priority_id].blank? ? nil : Enumeration.find_by_id(params[:priority_id]) | |
209 | assigned_to = params[:assigned_to_id].blank? ? nil : User.find_by_id(params[:assigned_to_id]) |
|
209 | assigned_to = (params[:assigned_to_id].blank? || params[:assigned_to_id] == 'none') ? nil : User.find_by_id(params[:assigned_to_id]) | |
210 | category = params[:category_id].blank? ? nil : @project.issue_categories.find_by_id(params[:category_id]) |
|
210 | category = (params[:category_id].blank? || params[:category_id] == 'none') ? nil : @project.issue_categories.find_by_id(params[:category_id]) | |
211 | fixed_version = params[:fixed_version_id].blank? ? nil : @project.versions.find_by_id(params[:fixed_version_id]) |
|
211 | fixed_version = (params[:fixed_version_id].blank? || params[:fixed_version_id] == 'none') ? nil : @project.versions.find_by_id(params[:fixed_version_id]) | |
212 |
|
212 | |||
213 | unsaved_issue_ids = [] |
|
213 | unsaved_issue_ids = [] | |
214 | @issues.each do |issue| |
|
214 | @issues.each do |issue| | |
215 | journal = issue.init_journal(User.current, params[:notes]) |
|
215 | journal = issue.init_journal(User.current, params[:notes]) | |
216 | issue.priority = priority if priority |
|
216 | issue.priority = priority if priority | |
217 | issue.assigned_to = assigned_to if assigned_to || params[:assigned_to_id] == 'none' |
|
217 | issue.assigned_to = assigned_to if assigned_to || params[:assigned_to_id] == 'none' | |
218 | issue.category = category if category |
|
218 | issue.category = category if category || params[:category_id] == 'none' | |
219 | issue.fixed_version = fixed_version if fixed_version |
|
219 | issue.fixed_version = fixed_version if fixed_version || params[:fixed_version_id] == 'none' | |
220 | issue.start_date = params[:start_date] unless params[:start_date].blank? |
|
220 | issue.start_date = params[:start_date] unless params[:start_date].blank? | |
221 | issue.due_date = params[:due_date] unless params[:due_date].blank? |
|
221 | issue.due_date = params[:due_date] unless params[:due_date].blank? | |
222 | issue.done_ratio = params[:done_ratio] unless params[:done_ratio].blank? |
|
222 | issue.done_ratio = params[:done_ratio] unless params[:done_ratio].blank? |
@@ -15,7 +15,9 | |||||
15 | <label><%= l(:field_priority) %>: |
|
15 | <label><%= l(:field_priority) %>: | |
16 | <%= select_tag('priority_id', "<option value=\"\">#{l(:label_no_change_option)}</option>" + options_from_collection_for_select(Enumeration.get_values('IPRI'), :id, :name)) %></label> |
|
16 | <%= select_tag('priority_id', "<option value=\"\">#{l(:label_no_change_option)}</option>" + options_from_collection_for_select(Enumeration.get_values('IPRI'), :id, :name)) %></label> | |
17 | <label><%= l(:field_category) %>: |
|
17 | <label><%= l(:field_category) %>: | |
18 | <%= select_tag('category_id', "<option value=\"\">#{l(:label_no_change_option)}</option>" + options_from_collection_for_select(@project.issue_categories, :id, :name)) %></label> |
|
18 | <%= select_tag('category_id', content_tag('option', l(:label_no_change_option), :value => '') + | |
|
19 | content_tag('option', l(:label_none), :value => 'none') + | |||
|
20 | options_from_collection_for_select(@project.issue_categories, :id, :name)) %></label> | |||
19 | </p> |
|
21 | </p> | |
20 | <p> |
|
22 | <p> | |
21 | <label><%= l(:field_assigned_to) %>: |
|
23 | <label><%= l(:field_assigned_to) %>: | |
@@ -23,7 +25,9 | |||||
23 | content_tag('option', l(:label_nobody), :value => 'none') + |
|
25 | content_tag('option', l(:label_nobody), :value => 'none') + | |
24 | options_from_collection_for_select(@project.assignable_users, :id, :name)) %></label> |
|
26 | options_from_collection_for_select(@project.assignable_users, :id, :name)) %></label> | |
25 | <label><%= l(:field_fixed_version) %>: |
|
27 | <label><%= l(:field_fixed_version) %>: | |
26 | <%= select_tag('fixed_version_id', "<option value=\"\">#{l(:label_no_change_option)}</option>" + options_from_collection_for_select(@project.versions, :id, :name)) %></label> |
|
28 | <%= select_tag('fixed_version_id', content_tag('option', l(:label_no_change_option), :value => '') + | |
|
29 | content_tag('option', l(:label_none), :value => 'none') + | |||
|
30 | options_from_collection_for_select(@project.versions, :id, :name)) %></label> | |||
27 | </p> |
|
31 | </p> | |
28 |
|
32 | |||
29 | <p> |
|
33 | <p> |
@@ -339,6 +339,16 class IssuesControllerTest < Test::Unit::TestCase | |||||
339 | assert_equal 'Bulk editing', Issue.find(1).journals.find(:first, :order => 'created_on DESC').notes |
|
339 | assert_equal 'Bulk editing', Issue.find(1).journals.find(:first, :order => 'created_on DESC').notes | |
340 | end |
|
340 | end | |
341 |
|
341 | |||
|
342 | def test_bulk_unassign | |||
|
343 | assert_not_nil Issue.find(2).assigned_to | |||
|
344 | @request.session[:user_id] = 2 | |||
|
345 | # unassign issues | |||
|
346 | post :bulk_edit, :ids => [1, 2], :notes => 'Bulk unassigning', :assigned_to_id => 'none' | |||
|
347 | assert_response 302 | |||
|
348 | # check that the issues were updated | |||
|
349 | assert_nil Issue.find(2).assigned_to | |||
|
350 | end | |||
|
351 | ||||
342 | def test_move_one_issue_to_another_project |
|
352 | def test_move_one_issue_to_another_project | |
343 | @request.session[:user_id] = 1 |
|
353 | @request.session[:user_id] = 1 | |
344 | post :move, :id => 1, :new_project_id => 2 |
|
354 | post :move, :id => 1, :new_project_id => 2 |
General Comments 0
You need to be logged in to leave comments.
Login now