diff --git a/app/helpers/contracts_helper.rb b/app/helpers/contracts_helper.rb index b7b9612..588a1e9 100644 --- a/app/helpers/contracts_helper.rb +++ b/app/helpers/contracts_helper.rb @@ -6,12 +6,14 @@ module ContractsHelper end end - def format_budget_for_deliverable(deliverable, spent, total) + def format_budget_for_deliverable(deliverable, spent, total, options={}) + extra_css_class = options[:class] || '' + if total > 0 || spent > 0 - content_tag(:td, h(number_to_currency(spent, :unit => '')), :class => 'spent-amount') + - content_tag(:td, h(number_to_currency(total, :unit => '')), :class => 'total-amount white') + content_tag(:td, h(number_to_currency(spent, :unit => '')), :class => 'spent-amount ' + extra_css_class) + + content_tag(:td, h(number_to_currency(total, :unit => '')), :class => 'total-amount white ' + extra_css_class) else - content_tag(:td, '----', :colspan => '2', :class => 'no-value') + content_tag(:td, '----', :colspan => '2', :class => 'no-value ' + extra_css_class) end end diff --git a/app/views/contracts/show.html.erb b/app/views/contracts/show.html.erb index 80bbd53..d191b21 100644 --- a/app/views/contracts/show.html.erb +++ b/app/views/contracts/show.html.erb @@ -102,8 +102,8 @@ <%= h deliverable.title %> TODO: Release 5 <%= h deliverable.manager.try(:name) %> - <%= format_budget_for_deliverable(deliverable, deliverable.labor_budget_spent, deliverable.labor_budget_total) %> - <%= format_budget_for_deliverable(deliverable, deliverable.overhead_spent, deliverable.overhead_budget_total) %> + <%= format_budget_for_deliverable(deliverable, deliverable.labor_budget_spent, deliverable.labor_budget_total, :class => 'labor') %> + <%= format_budget_for_deliverable(deliverable, deliverable.overhead_spent, deliverable.overhead_budget_total, :class => 'overhead') %> <%= format_budget_for_deliverable(deliverable, 0, 0) %><%# TODO: Release 2, Fixed Budgets %> <% end %> diff --git a/test/integration/deliverables_edit_test.rb b/test/integration/deliverables_edit_test.rb index 985729d..5ac2173 100644 --- a/test/integration/deliverables_edit_test.rb +++ b/test/integration/deliverables_edit_test.rb @@ -45,7 +45,7 @@ class DeliverablesEditTest < ActionController::IntegrationTest should "allow any user to edit the Hourly deliverable" do visit_contract_page(@contract) - click_link_within "#hourly_deliverable_#{@hourly_deliverable.id}", 'Edit' + click_link_within "#deliverable_details_#{@hourly_deliverable.id}", 'Edit' assert_response :success assert_template 'deliverables/edit'