From: Jean-Philippe Lang Date: Sun, 27 Mar 2011 15:00:02 +0000 (+0000) Subject: Allow bulk editing of parent issue (#5831). X-Git-Tag: 1.2.0~620 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=ca5951b4f621ec003d70a85362f34af63e38577f;p=redmine.git Allow bulk editing of parent issue (#5831). git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5224 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/app/views/issues/bulk_edit.rhtml b/app/views/issues/bulk_edit.rhtml index b26e47c8a..35ee17307 100644 --- a/app/views/issues/bulk_edit.rhtml +++ b/app/views/issues/bulk_edit.rhtml @@ -55,6 +55,14 @@
+<% if @project && User.current.allowed_to?(:manage_subtasks, @project) %> +

+ + <%= text_field_tag 'issue[parent_issue_id]', '', :size => 10 %> +

+
+<%= javascript_tag "observeParentIssueField('#{auto_complete_issues_path(:project_id => @project) }')" %> +<% end %>

<%= text_field_tag 'issue[start_date]', '', :size => 10 %><%= calendar_for('issue_start_date') %> diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb index 36421aa89..6e445438f 100644 --- a/test/functional/issues_controller_test.rb +++ b/test/functional/issues_controller_test.rb @@ -1091,6 +1091,8 @@ class IssuesControllerTest < ActionController::TestCase assert_response :success assert_template 'bulk_edit' + assert_tag :input, :attributes => {:name => 'issue[parent_issue_id]'} + # Project specific custom field, date type field = CustomField.find(9) assert !field.is_for_all? @@ -1108,6 +1110,9 @@ class IssuesControllerTest < ActionController::TestCase assert_response :success assert_template 'bulk_edit' + # Can not set issues from different projects as children of an issue + assert_no_tag :input, :attributes => {:name => 'issue[parent_issue_id]'} + # Project specific custom field, date type field = CustomField.find(9) assert !field.is_for_all? @@ -1197,6 +1202,19 @@ class IssuesControllerTest < ActionController::TestCase issue = Issue.find(1) assert issue.closed? end + + def test_bulk_update_parent_id + @request.session[:user_id] = 2 + post :bulk_update, :ids => [1, 3], + :notes => 'Bulk editing parent', + :issue => {:priority_id => '', :assigned_to_id => '', :status_id => '', :parent_issue_id => '2'} + + assert_response 302 + parent = Issue.find(2) + assert_equal parent.id, Issue.find(1).parent_id + assert_equal parent.id, Issue.find(3).parent_id + assert_equal [1, 3], parent.children.collect(&:id).sort + end def test_bulk_update_custom_field @request.session[:user_id] = 2