##// END OF EJS Templates
Fixed that the bulk edit/copy form does not propose versions and categories for the target project (#10350)....
Jean-Philippe Lang -
r8926:7448e0dbc41a
parent child
Show More
@@ -221,7 +221,7 class IssuesController < ApplicationController
221 221 if User.current.allowed_to?(:move_issues, @projects)
222 222 @allowed_projects = Issue.allowed_target_projects_on_move
223 223 if params[:issue]
224 @target_project = @allowed_projects.detect {|p| p.id.to_s == params[:issue][:project_id]}
224 @target_project = @allowed_projects.detect {|p| p.id.to_s == params[:issue][:project_id].to_s}
225 225 if @target_project
226 226 target_projects = [@target_project]
227 227 end
@@ -233,6 +233,8 class IssuesController < ApplicationController
233 233 @custom_fields = target_projects.map{|p|p.all_issue_custom_fields}.reduce(:&)
234 234 @assignables = target_projects.map(&:assignable_users).reduce(:&)
235 235 @trackers = target_projects.map(&:trackers).reduce(:&)
236 @versions = target_projects.map {|p| p.shared_versions.open}.reduce(:&)
237 @categories = target_projects.map {|p| p.issue_categories}.reduce(:&)
236 238
237 239 @safe_attributes = @issues.map(&:safe_attribute_names).reduce(:&)
238 240 render :layout => false if request.xhr?
@@ -43,23 +43,18
43 43 content_tag('option', l(:label_nobody), :value => 'none') +
44 44 principals_options_for_select(@assignables)) %>
45 45 </p>
46 <% if @project %>
47 46 <p>
48 47 <label for='issue_category_id'><%= l(:field_category) %></label>
49 48 <%= select_tag('issue[category_id]', content_tag('option', l(:label_no_change_option), :value => '') +
50 49 content_tag('option', l(:label_none), :value => 'none') +
51 options_from_collection_for_select(@project.issue_categories, :id, :name)) %>
50 options_from_collection_for_select(@categories, :id, :name)) %>
52 51 </p>
53 <% end %>
54 <% #TODO: allow editing versions when multiple projects %>
55 <% if @project %>
56 52 <p>
57 53 <label for='issue_fixed_version_id'><%= l(:field_fixed_version) %></label>
58 54 <%= select_tag('issue[fixed_version_id]', content_tag('option', l(:label_no_change_option), :value => '') +
59 55 content_tag('option', l(:label_none), :value => 'none') +
60 version_options_for_select(@project.shared_versions.open.sort)) %>
56 version_options_for_select(@versions.sort)) %>
61 57 </p>
62 <% end %>
63 58
64 59 <% @custom_fields.each do |custom_field| %>
65 60 <p><label><%= h(custom_field.name) %></label> <%= custom_field_tag_for_bulk_edit('issue', custom_field, @projects) %></p>
@@ -2672,6 +2672,28 class IssuesControllerTest < ActionController::TestCase
2672 2672 :children => {:count => 3} # 2 statuses + "no change" option
2673 2673 end
2674 2674
2675 def test_bulk_edit_should_propose_target_project_open_shared_versions
2676 @request.session[:user_id] = 2
2677 post :bulk_edit, :ids => [1, 2, 6], :issue => {:project_id => 1}
2678 assert_response :success
2679 assert_template 'bulk_edit'
2680 assert_equal Project.find(1).shared_versions.open.all.sort, assigns(:versions).sort
2681 assert_tag 'select',
2682 :attributes => {:name => 'issue[fixed_version_id]'},
2683 :descendant => {:tag => 'option', :content => '2.0'}
2684 end
2685
2686 def test_bulk_edit_should_propose_target_project_categories
2687 @request.session[:user_id] = 2
2688 post :bulk_edit, :ids => [1, 2, 6], :issue => {:project_id => 1}
2689 assert_response :success
2690 assert_template 'bulk_edit'
2691 assert_equal Project.find(1).issue_categories.sort, assigns(:categories).sort
2692 assert_tag 'select',
2693 :attributes => {:name => 'issue[category_id]'},
2694 :descendant => {:tag => 'option', :content => 'Recipes'}
2695 end
2696
2675 2697 def test_bulk_update
2676 2698 @request.session[:user_id] = 2
2677 2699 # update issues priority
General Comments 0
You need to be logged in to leave comments. Login now