[#6441] Hide and disable unassignable deliverables from the issue

* Hide - Closed deliverables
* Hide - Closed contract deliverables
* Disable - Locked deliverables
* Disable - Locked contract deliverables
This commit is contained in:
Eric Davis committed 2011-08-10 13:10:05 -07:00
1 parent f70ade5011
commit e019a9435e
8 files changed
+103 -14

No files matched your search

+15
View File
@@ -24,6 +24,21 @@ module ContractsHelper
end
end
def grouped_deliverable_options_for_select(project, selected_key=nil)
project.contracts.with_status(["open","locked"]).inject([]) do |html, contract|
options = contract.deliverables.with_status(["open","locked"]).collect do |deliverable|
option_attributes = {}
option_attributes[:value] = h(deliverable.id)
option_attributes[:selected] = "selected" if selected_key.to_i == deliverable.id
option_attributes[:disabled] = "disabled" if deliverable.locked? || contract.locked?
content_tag(:option, h(deliverable.title), option_attributes)
end
html << content_tag(:optgroup, options.join("\n"), :label => h(contract.name))
end.join('\n')
end
def deliverable_options_for_contract(contract)
contract.deliverables.collect {|d| [d.title, d.id]}
end