Fixed some tests.

This commit is contained in:
James Cole
2015-06-28 08:24:12 +02:00
parent 4673170531
commit e4e2921f3e
30 changed files with 49 additions and 153 deletions

View File

@@ -95,11 +95,6 @@ $(function () {
$('input[type="number"]').on('input', updateBudgetedAmounts);
//updateRanges();
//$('input[type="range"]').on('input', updateSingleRange);
//$('input[type="number"]').on('input', updateSingleRange);
/*
Draw the charts, if necessary:
*/
@@ -112,87 +107,7 @@ $(function () {
});
//function updateSingleRange(e) {
// "use strict";
// // get some values:
// var input = $(e.target);
// var id = input.data('id');
// var value = parseInt(input.val());
// var spent = parseFloat($('#spent-' + id).data('value'));
//
// // update small display:
// if (value > 0) {
// // show the input:
// $('#budget-info-' + id + ' span').show();
// $('#budget-info-' + id + ' input').show();
//
// // update the text:
// $('#budget-description-' + id).text('Budgeted: ');
// } else {
// // hide the input:
// $('#budget-info-' + id + ' span').hide();
// $('#budget-info-' + id + ' input').hide();
//
// // update the text:
// $('#budget-description-' + id).html('<em>No budget</em>');
// }
//
// // update the range display text:
// $('#budget-range-display-' + id).text('\u20AC ' + value.toFixed(2));
//
// // send a post to Firefly to update the amount:
// $.post('budgets/amount/' + id, {amount: value, _token: token}).success(function (data) {
// // update the link if relevant:
// $('#budget-link-' + id).attr('href', 'budgets/show/' + id + '/' + data.repetition);
// });
// if (input.attr('type') === 'number') {
// // update the range-input:
// $('#budget-range-' + id).val(value);
// } else {
// // update the number-input:
// $('#budget-info-' + id + ' input').val(value);
// }
//
// // update or hide the bar, whichever is necessary.
// updateTotal();
// return value;
//}
//
//function updateTotal() {
// "use strict";
// var sum = 0;
// $('input[type="range"]').each(function (i, v) {
// // get some values:
// sum += parseInt($(v).val());
// });
//
// /**
// * Update total sum:
// */
// var totalAmount = parseInt($('#totalAmount').data('value'));
// var pct;
// if (sum <= totalAmount) {
// pct = sum / totalAmount * 100;
// $('#progress-bar-default').css('width', pct + '%');
// $('#progress-bar-warning').css('width', '0');
// $('#progress-bar-danger').css('width', '0');
// $('#budgetedAmount').text('\u20AC ' + sum.toFixed(2)).addClass('text-success').removeClass('text-danger');
// } else {
// // we gaan er X overheen,
//
// pct = totalAmount / sum * 100;
// var danger = 100 - pct;
// var err = 100 - danger;
// $('#progress-bar-default').css('width', 0);
// $('#progress-bar-warning').css('width', err + '%');
// $('#progress-bar-danger').css('width', danger + '%');
// $('#budgetedAmount').text('\u20AC ' + sum.toFixed(2)).addClass('text-danger').removeClass('text-success');
// }
//
//}
//
function updateIncome(e) {
function updateIncome() {
"use strict";
$('#defaultModal').empty().load('budgets/income', function () {
$('#defaultModal').modal('show');
@@ -200,51 +115,3 @@ function updateIncome(e) {
return false;
}
//
//function updateRanges() {
// "use strict";
//
//
// var sum = 0;
// $('input[type="range"]').each(function (i, v) {
// // get some values:
// var input = $(v);
// var id = input.data('id');
// var value = parseInt(input.val());
//
// // calculate sum:
// sum += value;
//
// // update small display:
// $('#budget-range-display-' + id).text('\u20AC ' + value.toFixed(2));
//
// // send a post to Firefly to update the amount:
// $.post('budgets/amount/' + id, {amount: value, _token: token});
//
// });
//
// /**
// * Update total sum:
// */
// var totalAmount = parseInt($('#totalAmount').data('value'));
// var pct;
// if (sum <= totalAmount) {
// pct = sum / totalAmount * 100;
// $('#progress-bar-default').css('width', pct + '%');
// $('#progress-bar-warning').css('width', '0');
// $('#progress-bar-danger').css('width', '0');
// $('#budgetedAmount').text('\u20AC ' + sum.toFixed(2)).addClass('text-success').removeClass('text-danger');
// } else {
// // we gaan er X overheen,
//
// pct = totalAmount / sum * 100;
// var danger = 100 - pct;
// var err = 100 - danger;
// $('#progress-bar-default').css('width', 0);
// $('#progress-bar-warning').css('width', err + '%');
// $('#progress-bar-danger').css('width', danger + '%');
// $('#budgetedAmount').text('\u20AC ' + sum.toFixed(2)).addClass('text-danger').removeClass('text-success');
// }
//
//
//}