diff --git a/app/helpers/deliverables_helper.rb b/app/helpers/deliverables_helper.rb index dd6b02e..57fad5f 100644 --- a/app/helpers/deliverables_helper.rb +++ b/app/helpers/deliverables_helper.rb @@ -3,14 +3,16 @@ module DeliverablesHelper # Helper to generate a form used to calculate the total budget while editing # a Deliverable def field_with_budget_observer_and_totals(form, field) - content_tag(:p, - form.text_field(field, :size => 7) + - content_tag(:span, - 0, - :class => "budget-calculation", - :id => field.to_s + '_subtotal' - ) - ) + observe_field('deliverable_' + field.to_s, :function => "new Budget.updateAmounts();") + content_tag(:tr, + 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();"))) + end # Helper to generate a consistant HTML format for displaying basic data diff --git a/app/views/deliverables/_form.html.erb b/app/views/deliverables/_form.html.erb index 6a39fe3..e0faa8e 100644 --- a/app/views/deliverables/_form.html.erb +++ b/app/views/deliverables/_form.html.erb @@ -14,36 +14,70 @@
- - <%= check_box(:deliverable, :type, {}, FixedDeliverable.name, HourlyDeliverable.name) %> -
- <%= observe_field('deliverable_type', :function => "new Budget.changeType();") %> +| + + | ++ <%= check_box(:deliverable, :type, {}, FixedDeliverable.name, HourlyDeliverable.name) %> + <%= observe_field('deliverable_type', :function => "new Budget.changeType();") %> + | ++ | +
| + + | ++ <%= text_field :deliverable, :cost_per_hour, :size => 7 %> + <%= observe_field('deliverable_cost_per_hour', :function => "new Budget.updateAmounts();") %> + | ++ | +
| + + | ++ <%= 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') %> + | +
| + | + | <%= content_tag(:span, 0, :id => 'total-budget-calculation', :class => "budget-calculation") %> | +