Skip to content

Commit

Permalink
[#6574] Refactor: extract overhead budget form to partial
Browse files Browse the repository at this point in the history
  • Loading branch information
edavis10 committed Oct 11, 2011
1 parent ffaab6b commit ca84747
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 21 deletions.
25 changes: 4 additions & 21 deletions app/views/deliverables/_finance_form.html.erb
Expand Up @@ -24,27 +24,10 @@
<li class="numeric optional">
<%= content_tag(:label, l(:field_overhead)) %>
<table id="deliverable-overhead" class="deliverable_finance_table">

<% form.fields_for :overhead_budgets, overhead_budgets do |overhead_budget| %>
<%= overhead_budget.hidden_field(:year) %>
<%= overhead_budget.hidden_field(:month) %>
<tr>
<td>
<%= overhead_budget.label(:time_entry_activity_id, :class => "hidden") %>
<%= overhead_budget.select(:time_entry_activity_id, options_from_collection_for_select(@project.non_billable_activities, :id, :name, overhead_budget.object.time_entry_activity_id), {:include_blank => false}, {:class => 'financial'}) %>
</td>
<td>
<p class="inline-hints"><%= overhead_budget.label(:hours, l(:text_short_hours)) %></p>
<%= overhead_budget.text_field(:hours, :value => format_deliverable_value_fields(overhead_budget.object.hours),:class => 'financial') %>
</td>
<td>
<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>
</tr>
<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 %>
</table>
</li>
Expand Down
20 changes: 20 additions & 0 deletions app/views/deliverables/_overhead_budget_form.html.erb
@@ -0,0 +1,20 @@
<tr>
<td>
<%= overhead_budget.hidden_field(:year) %>
<%= overhead_budget.hidden_field(:month) %>
<%= overhead_budget.label(:time_entry_activity_id, :class => "hidden") %>
<%= overhead_budget.select(:time_entry_activity_id, options_from_collection_for_select(@project.non_billable_activities, :id, :name, overhead_budget.object.time_entry_activity_id), {:include_blank => false}, {:class => 'financial'}) %>
</td>
<td>
<p class="inline-hints"><%= overhead_budget.label(:hours, l(:text_short_hours)) %></p>
<%= overhead_budget.text_field(:hours, :value => format_deliverable_value_fields(overhead_budget.object.hours),:class => 'financial') %>
</td>
<td>
<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>
</tr>

0 comments on commit ca84747

Please sign in to comment.