Skip to content

Commit

Permalink
[#6441] Refactor: extract method
Browse files Browse the repository at this point in the history
  • Loading branch information
edavis10 committed Aug 10, 2011
1 parent e0ecae8 commit 256325a
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions app/helpers/contracts_helper.rb
Expand Up @@ -23,15 +23,19 @@ def grouped_deliverable_options_for_select(project, selected_key=nil)
if contract.closed? && !contract.includes_deliverable_id?(selected_key)
html
else
options = contract.deliverables.collect do |deliverable|
deliverable_option(deliverable, selected_key)
end

html << content_tag(:optgroup, options.join("\n"), :label => h(contract.name))
html << content_tag(:optgroup,
deliverable_options_for_contract(contract, selected_key).join("\n"),
:label => h(contract.name))
end
end
end

def deliverable_options_for_contract(contract, selected_key)
contract.deliverables.collect do |deliverable|
deliverable_option(deliverable, selected_key)
end
end

def deliverable_option(deliverable, selected_key)
option_attributes = {}
option_attributes[:value] = h(deliverable.id)
Expand Down

0 comments on commit 256325a

Please sign in to comment.