From 658730928bdb92ec99ba67de72758c77f9922b1b Mon Sep 17 00:00:00 2001 From: James Cole Date: Sun, 2 Jul 2017 09:24:00 +0200 Subject: [PATCH] Remove old JS --- public/js/ff/transactions/split/edit.js | 143 +----------------------- 1 file changed, 1 insertion(+), 142 deletions(-) diff --git a/public/js/ff/transactions/split/edit.js b/public/js/ff/transactions/split/edit.js index 0e02b11653..735a3c2088 100644 --- a/public/js/ff/transactions/split/edit.js +++ b/public/js/ff/transactions/split/edit.js @@ -89,28 +89,6 @@ function removeDivRow(e) { } -/** - * OLD - * @param e - * @returns {boolean} - */ -function removeRow(e) { - "use strict"; - var rows = $('table.split-table tbody tr'); - if (rows.length === 1) { - return false; - } - var row = $(e.target); - var index = row.data('split'); - $('table.split-table tbody tr[data-split="' + index + '"]').remove(); - - - resetSplits(); - - return false; - -} - /** * New and cool * @returns {boolean} @@ -140,7 +118,7 @@ function cloneDivRow() { $('div.split_row_holder').append(source); // remove original click things, add them again: - $('.remove-current-split').unbind('click').click(removeRow); + $('.remove-current-split').unbind('click').click(removeDivRow); calculateSum(); resetDivSplits(); @@ -148,44 +126,6 @@ function cloneDivRow() { return false; } -/** - * OLD - * @returns {boolean} - */ -function cloneRow() { - "use strict"; - var source = $('.table.split-table tbody tr').last().clone(); - var count = $('.split-table tbody tr').length + 1; - source.removeClass('initial-row'); - source.find('.count').text('#' + count); - - source.find('input[name$="][amount]"]').val("").on('input', calculateSum); - if (destAccounts.length > 0) { - source.find('input[name$="destination_account_name]"]').typeahead({source: destAccounts}); - } - - if (destAccounts.length > 0) { - source.find('input[name$="source_account_name]"]').typeahead({source: srcAccounts}); - } - if (categories.length > 0) { - source.find('input[name$="category]"]').typeahead({source: categories}); - } - if (descriptions.length > 0) { - source.find('input[name$="description]"]').typeahead({source: descriptions}); - } - - $('.split-table tbody').append(source); - - // remove original click things, add them again: - $('.remove-current-split').unbind('click').click(removeRow); - - - calculateSum(); - resetSplits(); - - return false; -} - /** * New and hip */ @@ -277,87 +217,6 @@ function resetDivSplits() { }); } -/** - * OLD - */ -function resetSplits() { - "use strict"; - // loop rows, reset numbers: - - // update the row split number: - $.each($('table.split-table tbody tr'), function (i, v) { - var row = $(v); - row.attr('data-split', i); - }); - - // loop each remove button, update the index - $.each($('.remove-current-split'), function (i, v) { - var button = $(v); - button.attr('data-split', i); - button.find('i').attr('data-split', i); - - }); - - // loop each indicator (#) and update it: - $.each($('td.count'), function (i, v) { - var cell = $(v); - var index = i + 1; - cell.text('#' + index); - }); - - // loop each possible field. - - // ends with ][description] - $.each($('input[name$="][description]"]'), function (i, v) { - var input = $(v); - input.attr('name', 'transactions[' + i + '][description]'); - }); - // ends with ][destination_account_name] - $.each($('input[name$="][destination_account_name]"]'), function (i, v) { - var input = $(v); - input.attr('name', 'transactions[' + i + '][destination_account_name]'); - }); - // ends with ][source_account_name] - $.each($('input[name$="][source_account_name]"]'), function (i, v) { - var input = $(v); - input.attr('name', 'transactions[' + i + '][source_account_name]'); - }); - // ends with ][amount] - $.each($('input[name$="][amount]"]'), function (i, v) { - var input = $(v); - input.attr('name', 'transactions[' + i + '][amount]'); - }); - - // ends with ][foreign_amount] - $.each($('input[name$="][foreign_amount]"]'), function (i, v) { - var input = $(v); - input.attr('name', 'transactions[' + i + '][foreign_amount]'); - }); - - // ends with ][transaction_currency_id] - $.each($('input[name$="][transaction_currency_id]"]'), function (i, v) { - var input = $(v); - input.attr('name', 'transactions[' + i + '][transaction_currency_id]'); - }); - - // ends with ][foreign_currency_id] - $.each($('input[name$="][foreign_currency_id]"]'), function (i, v) { - var input = $(v); - input.attr('name', 'transactions[' + i + '][foreign_currency_id]'); - }); - - // ends with ][budget_id] - $.each($('select[name$="][budget_id]"]'), function (i, v) { - var input = $(v); - input.attr('name', 'transactions[' + i + '][budget_id]'); - }); - - // ends with ][category] - $.each($('input[name$="][category]"]'), function (i, v) { - var input = $(v); - input.attr('name', 'transactions[' + i + '][category]'); - }); -} function calculateSum() { "use strict";