diff --git a/app/helpers/deliverables_helper.rb b/app/helpers/deliverables_helper.rb
index 8e6140b..29155e0 100644
--- a/app/helpers/deliverables_helper.rb
+++ b/app/helpers/deliverables_helper.rb
@@ -2,6 +2,7 @@ module DeliverablesHelper
# Helper to generate a form used to calculate the total budget while editing
# a Deliverable
+ # TODO Later: Refactor since observers are not used anymore
def field_with_budget_observer_and_totals(form, field)
content_tag(:tr,
content_tag(:td, "") +
@@ -11,7 +12,7 @@ module DeliverablesHelper
0,
:class => "budget-calculation",
:id => field.to_s + '_subtotal'
- ) + observe_field('deliverable_' + field.to_s, :function => "new Budget.updateAmounts();"),
+ ),
:class => "calculation-column"
))
diff --git a/app/views/deliverables/_form.html.erb b/app/views/deliverables/_form.html.erb
index 0bb38d6..7d38ddd 100644
--- a/app/views/deliverables/_form.html.erb
+++ b/app/views/deliverables/_form.html.erb
@@ -35,7 +35,6 @@
<%= text_field :deliverable, :cost_per_hour, :size => 7 %>
- <%= observe_field('deliverable_cost_per_hour', :function => "new Budget.updateAmounts();") %>
|
|
@@ -47,7 +46,6 @@
<%= 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') %>
@@ -60,7 +58,6 @@
|
<%= 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') %>
@@ -81,13 +78,19 @@
<%= f.hidden_field :budget %>
+ <%= observe_form('deliverable-form', :function => "new Budget.updateAmounts();", :on => 'blur') %>
+
+
+
-
-
<%= mode == :create ? submit_tag(l(:button_create)) : submit_tag(l(:button_update)) %>
<%= link_to_remote l(:label_preview),
@@ -124,6 +127,7 @@ Object.extend(BudgetModule.prototype, {
},
updateAmounts: function() {
+ console.log('updateAmounts() called');
if ($('deliverable_type').checked) {
// Fixed cost
var cost = Budget.toAmount($('deliverable_fixed_cost').value);
|