Update js [skip ci]

This commit is contained in:
James Cole 2015-05-24 20:41:14 +02:00
parent 8daccbfbb4
commit 860a0f790e
6 changed files with 36 additions and 27 deletions

View File

@ -1,3 +1,4 @@
/* globals require */
var elixir = require('laravel-elixir');
/*
@ -12,5 +13,6 @@ var elixir = require('laravel-elixir');
*/
elixir(function(mix) {
"use strict";
mix.less('app.less');
});

View File

@ -53,7 +53,7 @@ function updateSingleRange(e) {
// update the link if relevant:
$('#budget-link-' + id).attr('href', 'budgets/show/' + id + '/' + data.repetition);
});
if (input.attr('type') == 'number') {
if (input.attr('type') === 'number') {
// update the range-input:
$('#budget-range-' + id).val(value);
} else {
@ -126,13 +126,8 @@ function updateRanges() {
// update small display:
$('#budget-range-display-' + id).text('\u20AC ' + value.toFixed(2));
// update progress bar (if relevant)
var barHolder = $('#budget-progress-' + id);
var spent = parseFloat(barHolder.data('spent'));
// send a post to Firefly to update the amount:
$.post('budgets/amount/' + id, {amount: value, _token: token}).success(function (data) {
});
$.post('budgets/amount/' + id, {amount: value, _token: token});
});

View File

@ -1,5 +1,8 @@
/* globals $, googleLineChart, token */
// Return a helper with preserved width of cells
var fixHelper = function(e, tr) {
var fixHelper = function (e, tr) {
"use strict";
var $originals = tr.children();
var $helper = tr.clone();
$helper.children().each(function (index) {
@ -10,6 +13,7 @@ var fixHelper = function(e, tr) {
};
$(function () {
"use strict";
$('.addMoney').on('click', addMoney);
$('.removeMoney').on('click', removeMoney);
@ -43,8 +47,8 @@ $(function () {
});
function addMoney(e) {
"use strict";
var pigID = parseInt($(e.target).data('id'));
$('#moneyManagementModal').empty().load('piggy-banks/add/' + pigID, function () {
$('#moneyManagementModal').modal('show');
@ -54,6 +58,7 @@ function addMoney(e) {
}
function removeMoney(e) {
"use strict";
var pigID = parseInt($(e.target).data('id'));
$('#moneyManagementModal').empty().load('piggy-banks/remove/' + pigID, function () {
$('#moneyManagementModal').modal('show');
@ -62,15 +67,15 @@ function removeMoney(e) {
return false;
}
function stopSorting() {
"use strict";
$('.loadSpin').addClass('fa fa-refresh fa-spin');
var order = [];
$.each($('#sortable>tbody>tr'), function(i,v) {
$.each($('#sortable>tbody>tr'), function (i, v) {
var holder = $(v);
var id = holder.data('id');
order.push(id);
});
$.post('/piggy-banks/sort',{_token: token, order: order}).success(function(data) {
"use strict";
$.post('/piggy-banks/sort', {_token: token, order: order}).success(function () {
$('.loadSpin').removeClass('fa fa-refresh fa-spin');
});
}

View File

@ -1,9 +1,11 @@
/* globals expenseRestShow:true, incomeRestShow:true, year, shared, month, hideTheRest, showTheRest, showTheRestExpense, hideTheRestExpense, googleColumnChart, googleLineChart, googleStackedColumnChartg */
if (typeof(google) !== 'undefined') {
google.setOnLoadCallback(drawChart);
}
function drawChart() {
"use strict";
googleColumnChart('chart/report/in-out/' + year + shared, 'income-expenses-chart');
googleColumnChart('chart/report/in-out-sum/' + year + shared, 'income-expenses-sum-chart');
@ -13,16 +15,8 @@ function drawChart() {
googleLineChart('/chart/account/month/' + year + '/' + month + shared, 'account-balances-chart');
}
$(function () {
$('.openModal').on('click', openModal);
// click open the top X income list:
$('#showIncomes').click(showIncomes);
// click open the top X expense list:
$('#showExpenses').click(showExpenses);
});
function openModal(e) {
"use strict";
var target = $(e.target).parent();
@ -61,6 +55,7 @@ function showIncomes() {
}
function showExpenses() {
"use strict";
if (expenseRestShow) {
// hide everything, make button say "show"
$('#showExpenses').text(showTheRestExpense);
@ -78,4 +73,15 @@ function showExpenses() {
}
return false;
}
}
$(function () {
"use strict";
$('.openModal').on('click', openModal);
// click open the top X income list:
$('#showIncomes').click(showIncomes);
// click open the top X expense list:
$('#showExpenses').click(showExpenses);
});

View File

@ -1,5 +1,6 @@
/* globals zoomLevel, token, google, latitude, longitude */
$(function () {
"use strict";
/*
Hide and show the tag index help.
*/
@ -47,7 +48,7 @@ function clearLocation() {
}
function initialize() {
"use strict";
/*
Create new map:
*/
@ -91,6 +92,7 @@ function saveZoomLevel() {
* @param event
*/
function placeMarker(event) {
"use strict";
deleteMarkers();
var marker = new google.maps.Marker({position: event.latLng, map: map});
$('input[name="latitude"]').val(event.latLng.lat());
@ -105,6 +107,7 @@ function placeMarker(event) {
* Deletes all markers in the array by removing references to them.
*/
function deleteMarkers() {
"use strict";
for (var i = 0; i < markers.length; i++) {
markers[i].setMap(null);
}

View File

@ -1,8 +1,6 @@
/* globals what, $ */
$(document).ready(function () {
if (typeof googleTablePaged != 'undefined') {
googleTablePaged('table/transactions/' + what, 'transaction-table');
}
"use strict";
if ($('input[name="expense_account"]').length > 0) {
$.getJSON('json/expense-accounts').success(function (data) {
$('input[name="expense_account"]').typeahead({source: data});