From ad60e19617cdab10e950ab163a12fc04f0774ba5 Mon Sep 17 00:00:00 2001 From: Alexis Lahouze Date: Thu, 20 Aug 2015 11:41:43 +0200 Subject: [PATCH] Refactor setExtremes. --- accountant/frontend/static/js/entries.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/accountant/frontend/static/js/entries.js b/accountant/frontend/static/js/entries.js index ac2d622..667a2a8 100644 --- a/accountant/frontend/static/js/entries.js +++ b/accountant/frontend/static/js/entries.js @@ -171,7 +171,6 @@ accountantApp "SoldChartController", [ "$rootScope", "$scope", "$http", "$routeParams", function($rootScope, $scope, $http, $routeParams) { - // Configure chart for entries. $scope.config = { options: { @@ -240,7 +239,9 @@ accountantApp minRange: 3600 * 1000 * 24 * 14, // 2 weeks events: { afterSetExtremes: function(e) { - $scope.selectRange(moment.utc(e.min), moment.utc(e.max)); + $scope.$emit("rangeSelectedEvent", { + begin: moment.utc(e.min), end: moment.utc(e.max) + }); } }, currentMin: moment.utc().startOf('month'), @@ -260,10 +261,6 @@ accountantApp useHighStocks: true }; - $scope.selectRange = function(begin, end) { - $scope.$emit("rangeSelectedEvent", {begin: begin, end: end}); - }; - $scope.loadSolds = function() { $scope.config.loading = true;