Pagination in date mode

This commit is contained in:
Guillaume Wuip 2014-11-16 21:17:09 +01:00
parent 97af0ad87c
commit 63385d2b21
3 changed files with 54 additions and 1 deletions

View file

@ -9,14 +9,37 @@
window.app.controller('dateController', [ window.app.controller('dateController', [
'$scope', '$scope',
'$rootScope', '$rootScope',
'$location',
'$filter', '$filter',
'logs', 'logs',
'dates', 'dates',
function ($scope, $rootScope, $filter, logs, dates) { function ($scope, $rootScope, $location, $filter, logs, dates) {
//reset //reset
$rootScope.sidebar = false; $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 //build blocks
$scope.blocks = dates.map(function (item) { $scope.blocks = dates.map(function (item) {

View file

@ -11,5 +11,11 @@
force-file="onlyFiles" force-file="onlyFiles"
ng-click="block.click()" ng-click="block.click()"
></block> ></block>
<div class="nav">
<div class="btn previous" ng-click="nextPage(-10)"><</div>
<div class="btn pull-right next" ng-click="nextPage(10)">></div>
</div>
</div> </div>

View file

@ -250,6 +250,29 @@ body {
font-weight: 300; 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 * Menu
*/ */
@ -371,3 +394,4 @@ body {
right: 22px; right: 22px;
width: auto; width: auto;
} }