[#4327] Added the Deliverable field to the bulk edit.
This commit is contained in:
1 parent
6ad50c57b2
commit
72aeaac59a
5 files changed
+83
No files matched your search
@@ -0,0 +1,14 @@
|
|||||||
|
<% if project.module_enabled?(:contracts) %>
|
||||||
|
<p>
|
||||||
|
<%= label_tag(:deliverable_id, l(:field_deliverable)) %>
|
||||||
|
<% options = project.contracts.inject([]) {|data, contract|
|
||||||
|
data << [contract.name, contract.deliverables.collect {|d| [d.title, d.id]} ]
|
||||||
|
} %>
|
||||||
|
|
||||||
|
<%= select_tag('deliverable_id',
|
||||||
|
content_tag('option', l(:label_no_change_option), :value => '') +
|
||||||
|
content_tag('option', l(:label_none), :value => 'none') +
|
||||||
|
grouped_options_for_select(options)) %>
|
||||||
|
</p>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
@@ -69,3 +69,4 @@ require 'redmine_contracts/hooks/view_layouts_base_html_head_hook'
|
|||||||
require 'redmine_contracts/hooks/view_issues_show_details_bottom_hook'
|
require 'redmine_contracts/hooks/view_issues_show_details_bottom_hook'
|
||||||
require 'redmine_contracts/hooks/view_issues_form_details_bottom_hook'
|
require 'redmine_contracts/hooks/view_issues_form_details_bottom_hook'
|
||||||
require 'redmine_contracts/hooks/controller_issues_edit_before_save_hook'
|
require 'redmine_contracts/hooks/controller_issues_edit_before_save_hook'
|
||||||
|
require 'redmine_contracts/hooks/view_issues_bulk_edit_details_bottom_hook'
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
module RedmineContracts
|
||||||
|
module Hooks
|
||||||
|
class ViewIssuesBulkEditDetailsBottomHook < Redmine::Hook::ViewListener
|
||||||
|
|
||||||
|
render_on(:view_issues_bulk_edit_details_bottom, :partial => 'issues/bulk_edit_deliverable', :layout => false)
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
+55
@@ -0,0 +1,55 @@
|
|||||||
|
require File.dirname(__FILE__) + '/../../../test_helper'
|
||||||
|
|
||||||
|
class RedmineContracts::Hooks::ViewIssuesBulkEditDetailsBottomHookTest < ActionController::IntegrationTest
|
||||||
|
include Redmine::Hook::Helper
|
||||||
|
|
||||||
|
context "#view_issues_bulk_edit_details_bottom" do
|
||||||
|
setup do
|
||||||
|
@project = Project.generate!
|
||||||
|
@issue = Issue.generate_for_project!(@project)
|
||||||
|
@issue2 = Issue.generate_for_project!(@project)
|
||||||
|
@issue3 = Issue.generate_for_project!(@project)
|
||||||
|
@contract1 = Contract.generate!(:project => @project)
|
||||||
|
@contract2 = Contract.generate!(:project => @project)
|
||||||
|
|
||||||
|
@manager = User.generate!(:login => 'manager', :password => 'existing', :password_confirmation => 'existing')
|
||||||
|
@role = Role.generate!(:permissions => [:view_issues, :edit_issues])
|
||||||
|
User.add_to_project(@manager, @project, @role)
|
||||||
|
@deliverable1 = FixedDeliverable.generate!(:contract => @contract1, :manager => @manager, :title => 'The Title')
|
||||||
|
@deliverable2 = FixedDeliverable.generate!(:contract => @contract2, :manager => @manager, :title => 'The Title')
|
||||||
|
@issue.deliverable = @deliverable1
|
||||||
|
|
||||||
|
login_as('manager', 'existing')
|
||||||
|
end
|
||||||
|
|
||||||
|
context "with Contracts Enabled" do
|
||||||
|
setup do
|
||||||
|
visit_issue_bulk_edit_page([@issue, @issue2, @issue3])
|
||||||
|
end
|
||||||
|
|
||||||
|
should "render the a select field for the deliverables with all of the deliverables grouped by contract" do
|
||||||
|
|
||||||
|
assert_select "select#deliverable_id" do
|
||||||
|
assert_select "optgroup[label=?]", @contract1.name do
|
||||||
|
assert_select "option", :text => /#{@deliverable1.title}/
|
||||||
|
end
|
||||||
|
|
||||||
|
assert_select "optgroup[label=?]", @contract2.name do
|
||||||
|
assert_select "option", :text => /#{@deliverable2.title}/
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context "with Contracts Disabled" do
|
||||||
|
setup do
|
||||||
|
@project.enabled_modules.collect {|m| m.destroy if m.name == 'contracts' }
|
||||||
|
visit_issue_bulk_edit_page([@issue, @issue2, @issue3])
|
||||||
|
end
|
||||||
|
|
||||||
|
should "not render the deliverable select field" do
|
||||||
|
assert_select 'select#deliverable_id', :count => 0
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -75,6 +75,10 @@ module IntegrationTestHelper
|
|||||||
visit '/issues/' + issue.id.to_s
|
visit '/issues/' + issue.id.to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def visit_issue_bulk_edit_page(issues)
|
||||||
|
visit url_for(:controller => 'issues', :action => 'bulk_edit', :ids => issues.collect(&:id))
|
||||||
|
end
|
||||||
|
|
||||||
def assert_forbidden
|
def assert_forbidden
|
||||||
assert_response :forbidden
|
assert_response :forbidden
|
||||||
assert_template 'common/403'
|
assert_template 'common/403'
|
||||||
|
|||||||
Reference in new issue
Block a user