diff options
| author | pliablepixels <pliablepixels@gmail.com> | 2016-03-09 12:55:05 -0500 |
|---|---|---|
| committer | pliablepixels <pliablepixels@gmail.com> | 2016-03-09 12:55:05 -0500 |
| commit | 68d038f31a013c73b47ad13f9c44a12e13a11248 (patch) | |
| tree | cb6b75b1dd02b95b2c12cb42eb66690f883842a7 /www | |
| parent | 8eb9393b49ae28f994bbc4796c0cac33c15bfe3c (diff) | |
#177 - navigate +1 or -1 days via new buttons at top
Former-commit-id: 0a5695204ce7bdbc41a3f501fb499bfbb4680665
Diffstat (limited to 'www')
| -rw-r--r-- | www/js/TimelineCtrl.js | 25 | ||||
| -rw-r--r-- | www/templates/timeline.html | 6 |
2 files changed, 28 insertions, 3 deletions
diff --git a/www/js/TimelineCtrl.js b/www/js/TimelineCtrl.js index 30bb6089..4632b2a8 100644 --- a/www/js/TimelineCtrl.js +++ b/www/js/TimelineCtrl.js @@ -110,6 +110,31 @@ angular.module('zmApp.controllers').controller('zmApp.TimelineCtrl', ['$ionicPla }; + //----------------------------------------- + // Move by X days + //----------------------------------------- + $scope.moveDays = function (d) + { + var range = timeline.getWindow(); + var ds = moment(range.start); + if (d>0) + ds.add(d, 'days'); + else + ds.subtract(Math.abs(d), 'days'); + + var es = moment(ds); // clone it! + es.add (1, 'day'); + + fromDate = ds.format("YYYY-MM-DD HH:mm:ss"); + toDate = es.format("YYYY-MM-DD HH:mm:ss"); + + $scope.fromDate = fromDate; + $scope.toDate = toDate; + $rootScope.customTimelineRange = false; + ZMDataModel.zmLog ("moving by " + d + " day to " + fromDate + " upto " + toDate); + drawGraph(fromDate, toDate, maxItems); + + }; diff --git a/www/templates/timeline.html b/www/templates/timeline.html index 7ac71513..0a59e5f9 100644 --- a/www/templates/timeline.html +++ b/www/templates/timeline.html @@ -3,9 +3,9 @@ <ion-nav-buttons side="left"> <button class="button button-icon button-clear ion-navicon" ng-click="openMenu()"></button> - <!-- - <button class="button button-icon button-clear ion-arrow-left-c" ng-click="move(0.2)"></button> - <button class="button button-icon button-clear ion-arrow-right-c" ng-click="move(-0.2)"></button>--> + + <button class="button button-icon button-clear ion-arrow-left-c" ng-click="moveDays(-1);"></button> + <button class="button button-icon button-clear ion-arrow-right-c" ng-click="moveDays(1);"></button> <button data-badge="{{$root.alarmCount}}" class="animated infinite tada button button-icon button-clear ion-ios-bell notification-badge" ng-click="handleAlarms();" ng-if="$root.isAlarm"></button> |
