[#5421] Add Assign Deliverable to Issue permission for the new/edit issue form
This commit is contained in:
1 parent
75680e5a49
commit
40fc6e9751
3 files changed
+33
-13
No files matched your search
@@ -1,4 +1,4 @@
|
|||||||
<% if project.module_enabled?(:contracts) %>
|
<% if project.module_enabled?(:contracts) && User.current.allowed_to?(:assign_deliverable_to_issue, project) %>
|
||||||
<p>
|
<p>
|
||||||
<% options = project.contracts.inject([]) {|data, contract|
|
<% options = project.contracts.inject([]) {|data, contract|
|
||||||
data << [contract.name, contract.deliverables.collect {|d| [d.title, d.id]} ]
|
data << [contract.name, contract.deliverables.collect {|d| [d.title, d.id]} ]
|
||||||
|
|||||||
@@ -21,6 +21,10 @@ Redmine::Plugin.register :redmine_contracts do
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
project_module :issue_tracking do
|
||||||
|
permission(:assign_deliverable_to_issue, {})
|
||||||
|
end
|
||||||
|
|
||||||
contract_list_submenu_items = Proc.new {|project|
|
contract_list_submenu_items = Proc.new {|project|
|
||||||
if project && project.module_enabled?(:contracts)
|
if project && project.module_enabled?(:contracts)
|
||||||
|
|
||||||
|
|||||||
+28
-12
@@ -21,23 +21,39 @@ class RedmineContracts::Hooks::ViewIssuesFormDetailsBottomTest < ActionControlle
|
|||||||
end
|
end
|
||||||
|
|
||||||
context "with Contracts Enabled" do
|
context "with Contracts Enabled" do
|
||||||
setup do
|
context "with permission to Assign Deliverable" do
|
||||||
visit_issue_page(@issue)
|
setup do
|
||||||
end
|
@role.permissions << :assign_deliverable_to_issue
|
||||||
|
@role.save!
|
||||||
should "render the a select field for the deliverables with all of the deliverables grouped by contract" do
|
visit_issue_page(@issue)
|
||||||
assert_select "select#issue_deliverable_id" do
|
end
|
||||||
assert_select "optgroup[label=?]", @contract1.name do
|
|
||||||
assert_select "option", :text => /#{@deliverable1.title}/
|
|
||||||
end
|
|
||||||
|
|
||||||
assert_select "optgroup[label=?]", @contract2.name do
|
should "render the a select field for the deliverables with all of the deliverables grouped by contract" do
|
||||||
assert_select "option", :text => /#{@deliverable2.title}/
|
assert_select "select#issue_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
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
context "with no permission to Assign Deliverable" do
|
||||||
|
setup do
|
||||||
|
@role.permissions.delete(:assign_deliverable_to_issue)
|
||||||
|
@role.save!
|
||||||
|
visit_issue_page(@issue)
|
||||||
|
end
|
||||||
|
|
||||||
|
should "not render the deliverable select field" do
|
||||||
|
assert_select 'select#issue_deliverable_id', :count => 0
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
context "with Contracts Disabled" do
|
context "with Contracts Disabled" do
|
||||||
setup do
|
setup do
|
||||||
@project.enabled_modules.collect {|m| m.destroy if m.name == 'contracts' }
|
@project.enabled_modules.collect {|m| m.destroy if m.name == 'contracts' }
|
||||||
|
|||||||
Reference in new issue
Block a user