From 61270c60d595f4a8a77c1c4de0e5cfe97d0ca248 Mon Sep 17 00:00:00 2001 From: Eric Davis Date: Mon, 9 Aug 2010 12:47:45 -0700 Subject: [PATCH] [#4178] Fixed some more tests from the UI changes. --- app/helpers/contracts_helper.rb | 10 ++++++---- app/views/contracts/show.html.erb | 4 ++-- test/integration/deliverables_edit_test.rb | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) 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'