From 52d6687f52cdfa349f01faa969cce45191323dc7 Mon Sep 17 00:00:00 2001 From: Eric Davis Date: Thu, 12 Jun 2008 15:04:01 -0700 Subject: [PATCH] More form cleanup. #1274 --- app/helpers/deliverables_helper.rb | 10 ++++++++-- app/views/deliverables/_form.html.erb | 10 ++++++---- assets/stylesheets/budget.css | 4 +++- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/app/helpers/deliverables_helper.rb b/app/helpers/deliverables_helper.rb index 57fad5f..0537a33 100644 --- a/app/helpers/deliverables_helper.rb +++ b/app/helpers/deliverables_helper.rb @@ -4,14 +4,16 @@ module DeliverablesHelper # a Deliverable def field_with_budget_observer_and_totals(form, field) content_tag(:tr, - content_tag(:td, "") + + content_tag(:td, "") + content_tag(:td, text_field(:deliverable, field, :size => 7)) + content_tag(:td, content_tag(:span, 0, :class => "budget-calculation", :id => field.to_s + '_subtotal' - ) + observe_field('deliverable_' + field.to_s, :function => "new Budget.updateAmounts();"))) + ) + observe_field('deliverable_' + field.to_s, :function => "new Budget.updateAmounts();"), + :class => "calculation-column" + )) end @@ -37,4 +39,8 @@ module DeliverablesHelper def allowed_management? return User.current.allowed_to?(:manage_budget, @project) end + + def l_field(field, prefix='') + l((prefix + field.to_s).to_sym) + end end diff --git a/app/views/deliverables/_form.html.erb b/app/views/deliverables/_form.html.erb index e0faa8e..50678e5 100644 --- a/app/views/deliverables/_form.html.erb +++ b/app/views/deliverables/_form.html.erb @@ -24,7 +24,7 @@ <%= check_box(:deliverable, :type, {}, FixedDeliverable.name, HourlyDeliverable.name) %> <%= observe_field('deliverable_type', :function => "new Budget.changeType();") %> - + @@ -48,7 +48,7 @@ <%= text_field :deliverable, :total_hours, :size => 7 %> <%= observe_field('deliverable_total_hours', :function => "new Budget.updateAmounts();") %> - + <%= content_tag(:span, 0, :class => "budget-calculation", :id => 'variableCost') %> @@ -61,7 +61,7 @@ <%= text_field :deliverable, :fixed_cost, :size => 7 %> <%= observe_field('deliverable_fixed_cost', :function => "new Budget.updateAmounts();") %> - + <%= content_tag(:span, 0, :class => "budget-calculation", :id => 'fixedCost') %> @@ -73,7 +73,9 @@ - <%= content_tag(:span, 0, :id => 'total-budget-calculation', :class => "budget-calculation") %> + + <%= content_tag(:span, 0, :id => 'total-budget-calculation', :class => "budget-calculation") %> + diff --git a/assets/stylesheets/budget.css b/assets/stylesheets/budget.css index 93f3a9b..f7b6671 100644 --- a/assets/stylesheets/budget.css +++ b/assets/stylesheets/budget.css @@ -33,7 +33,9 @@ tr.deliverable-details div { text-align:left; } #deliverable-form .splitcontentright p { padding-right: 30px; } #deliverable-form .splitcontentright input { float:left } -span.budget-calculation { color:#999999; font-weight:bold; display:block; text-align:right; width: 100%;} + +td.calculation-column { text-align:right; width: auto; } +.budget-calculation { color:#999999; font-weight:bold; display:block; text-align:right; width: 100%;} p.total-budget { font-weight: bold; } p.total-budget #total-budget-calculation { }