Skip to content

Commit

Permalink
[#6574] Add button for multiple Labor Budgets
Browse files Browse the repository at this point in the history
  • Loading branch information
edavis10 committed Oct 11, 2011
1 parent f044532 commit 237b220
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/views/deliverables/_labor_budget_form.html.erb
Expand Up @@ -14,7 +14,7 @@
<p class="inline-hints"><%= labor_budget.label(:budget, l(:text_dollar_sign)) %></p>
<%= labor_budget.text_field(:budget, :value => format_deliverable_value_fields(labor_budget.object.budget), :class => 'financial') %>
</td>
<td>
<%= release(3, "Green Add button for multiple records") %>
<td class="add-labor">
<%= link_to_function("Add", 'addNewDeliverableFinance("labor")', :class => 'icon icon-add', :style => 'display:none;') %>
</td>
</tr>
6 changes: 6 additions & 0 deletions assets/javascripts/contracts.js
Expand Up @@ -68,15 +68,21 @@ jQuery(function($) {
}
},

showDeliverableAddButton = function() {
$('.add-labor a').hide().last().show();
},

addNewDeliverableFinance = function(financeType) {
var t = $('#labor-budget-template').tmpl({});
var countOfExisting = $("#deliverable-labor tbody tr").size();
var recordLocation = countOfExisting + 1; // increments the Rails [n] placeholder
var newContent = t.html().replace(/\[0\]/g, "[" + recordLocation + "]");

$("<tr>" + newContent + '</tr>').appendTo('#deliverable-labor tbody');
showDeliverableAddButton();
},

showDeliverableAddButton();
toggleSpecificDeliverableFields($('form.deliverable'));

$('select#deliverable_type').change(function() {
Expand Down

0 comments on commit 237b220

Please sign in to comment.