From 63385d2b21460dbbc82abb900fc46f5d0dd846ca Mon Sep 17 00:00:00 2001 From: Guillaume Wuip Date: Sun, 16 Nov 2014 21:17:09 +0100 Subject: [PATCH] Pagination in date mode --- static/js/controllers/dateController.js | 25 ++++++++++++++++++++++++- static/partials/dates.html | 6 ++++++ static/style.css | 24 ++++++++++++++++++++++++ 3 files changed, 54 insertions(+), 1 deletion(-) diff --git a/static/js/controllers/dateController.js b/static/js/controllers/dateController.js index afdb3d8..e634999 100644 --- a/static/js/controllers/dateController.js +++ b/static/js/controllers/dateController.js @@ -9,14 +9,37 @@ window.app.controller('dateController', [ '$scope', '$rootScope', + '$location', '$filter', 'logs', 'dates', - function ($scope, $rootScope, $filter, logs, dates) { + function ($scope, $rootScope, $location, $filter, logs, dates) { //reset $rootScope.sidebar = false; + /** + * $scope.nextPage + * + * Go to to a next page + * + * @param {int} next if < 0, goes to older dates, if > 0 goes to newer dates + */ + $scope.nextPage = function (next) { + + var currentDate = $location.search().from || Date.now(), + day = 24 * 60 * 60 * 1000; + + $rootScope.go( + 'dates', + { + path : $location.search().path, + from : next * day + parseInt(currentDate, 10), + length : 10 + } + ); + }; + //build blocks $scope.blocks = dates.map(function (item) { diff --git a/static/partials/dates.html b/static/partials/dates.html index 7c1eb64..6c705e0 100644 --- a/static/partials/dates.html +++ b/static/partials/dates.html @@ -11,5 +11,11 @@ force-file="onlyFiles" ng-click="block.click()" > + + + diff --git a/static/style.css b/static/style.css index 5d93e95..5c17a78 100644 --- a/static/style.css +++ b/static/style.css @@ -250,6 +250,29 @@ body { font-weight: 300; } +/** + * Nav + */ +.nav { + position: absolute; + bottom: 0; + left: 0; + width: 100%; +} + .nav > .btn { + display: inline-block; + padding: 4px 14px; + background: rgba(255, 255, 255, 0.2); + box-shadow: #101 0px 0px 6px; + border-radius : 4px; + font-size: 38px; + color: #e2e2e2; + } + .nav > .btn:hover { + cursor: pointer; + background: rgba(255, 255, 255, 0.3); + } + /** * Menu */ @@ -371,3 +394,4 @@ body { right: 22px; width: auto; } +