Remove category chart from report controller.

This commit is contained in:
James Cole
2016-05-15 16:13:05 +02:00
parent bd818b2dea
commit 6a750a998f
48 changed files with 30 additions and 434 deletions

View File

@@ -1,61 +0,0 @@
/*
* boxes.js
* Copyright (C) 2016 thegrumpydictator@gmail.com
*
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
*/
$(function () {
"use strict";
$('button[data-widget="collapse"]').click(storeBoxState);
// restore boxes to their original state:
$.each($('.box'), function (i, v) {
var box = $(v);
if (box.attr('id')) {
var state = getBoxState(box.attr('id'));
console.log('Box ' + box.attr('id') + ' should be ' + state);
if(state == 'closed') {
$('button[data-widget="collapse"]', box).click();
}
}
});
});
function storeBoxState(e) {
"use strict";
//Find the box parent
var button = $(e.target);
var box = button.parents(".box").first();
var id = box.attr('id');
if (id) {
console.log('Box has id: ' + id);
if (box.hasClass('collapsed-box')) {
setBoxState(id, 'open');
console.log('Box "' + id + '" is now opening / open.');
} else {
setBoxState(id, 'closed');
console.log('Box "' + id + '" is now closing / closed.');
}
}
}
function setBoxState(id, state) {
"use strict";
var index = 'ff-box-state-' + id;
if (typeof(Storage) !== "undefined") {
localStorage.setItem(index, state);
}
}
function getBoxState(id) {
"use strict";
var index = 'ff-box-state-' + id;
if (typeof(Storage) !== "undefined") {
var state = localStorage.getItem(index);
if (state) {
return state;
}
}
return 'open';
}

View File

@@ -27,15 +27,6 @@ function drawChart() {
columnChart('chart/budget/period/' + budgetId + '/' + reportType + '/' + startDate + '/' + endDate + '/' + accountIds, id);
});
// and another loop
$.each($('.category_year_chart'), function (i, v) {
var holder = $(v);
var id = holder.attr('id');
var categoryId = holder.data('category');
columnChart('chart/category/period/' + categoryId + '/' + reportType + '/' + startDate + '/' + endDate + '/' + accountIds, id);
});
}