[#6574] Allow creating and deleting multiple overhead budgets

This commit is contained in:
Eric Davis
2011-10-11 14:45:49 -07:00
parent ce6c89cfa7
commit 2ef8cd9b4e
5 changed files with 36 additions and 13 deletions
+1 -1
View File
@@ -12,7 +12,7 @@ class Deliverable < ActiveRecord::Base
has_many :issues, :dependent => :nullify
accepts_nested_attributes_for :labor_budgets, :allow_destroy => true
accepts_nested_attributes_for :overhead_budgets
accepts_nested_attributes_for :overhead_budgets, :allow_destroy => true
accepts_nested_attributes_for :fixed_budgets
# Validations
@@ -4,6 +4,12 @@
<% end %>
</script>
<script type="text/html" id="overhead-budget-template">
<% form.fields_for :overhead_budgets, resource.overhead_budgets.new(:id => 0) do |overhead_budget| %>
<%= render :partial => 'overhead_budget_form', :locals => {:overhead_budget => overhead_budget} %>
<% end %>
</script>
<% form.inputs :name => label, :class => "deliverable-finances #{fieldset_class}" do %>
<li style="display:none;" id='retainer-finances-message'>
@@ -27,8 +33,8 @@
<tbody>
<% form.fields_for :overhead_budgets, overhead_budgets.sort_by(&:id) do |overhead_budget| %>
<%= render :partial => 'overhead_budget_form', :locals => {:overhead_budget => overhead_budget} %>
</tbody>
<% end %>
</tbody>
</table>
</li>
@@ -1,4 +1,4 @@
<tr>
<tr class="overhead-budget-form">
<td>
<%= overhead_budget.hidden_field(:year) %>
<%= overhead_budget.hidden_field(:month) %>
@@ -14,7 +14,9 @@
<p class="inline-hints"><%= overhead_budget.label(:budget, l(:text_dollar_sign)) %></p>
<%= overhead_budget.text_field(:budget, :value => format_deliverable_value_fields(overhead_budget.object.budget), :class => 'financial') %>
</td>
<td>
<%= release(3, "Green Add button for multiple records") %>
<td class="add-overhead">
<%= overhead_budget.hidden_field "_destroy", :class=> "delete-flag" %>
<%= link_to_function(l(:button_delete), 'deleteDeliverableFinance(this)', :class => 'delete icon icon-del') %>
<%= link_to_function(l(:button_add), 'addNewDeliverableOverheadItem()', :class => 'add icon icon-add', :style => 'display:none;') %>
</td>
</tr>