forked from mirrors/Scribe.js
Pagination in date mode
This commit is contained in:
parent
97af0ad87c
commit
63385d2b21
3 changed files with 54 additions and 1 deletions
|
@ -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) {
|
||||
|
||||
|
|
|
@ -11,5 +11,11 @@
|
|||
force-file="onlyFiles"
|
||||
ng-click="block.click()"
|
||||
></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>
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue