add pager to blocks within certain date

This commit is contained in:
Matias Alejo Garcia 2014-05-30 11:50:18 -03:00
parent 36b183f26d
commit d28d83b90a
4 changed files with 19 additions and 5 deletions

File diff suppressed because one or more lines are too long

View File

@ -23,7 +23,7 @@ angular.module('insight').config(function($routeProvider) {
templateUrl: '/views/block_list.html',
title: 'Bitcoin Blocks solved Today'
}).
when('/blocks-date/:blockDate', {
when('/blocks-date/:blockDate/:startTimestamp?', {
templateUrl: '/views/block_list.html',
title: 'Bitcoin Blocks solved '
}).

View File

@ -49,11 +49,21 @@ angular.module('insight.blocks').controller('BlocksController',
$scope.loading = true;
if ($routeParams.blockDate) {
$rootScope.titleDetail = 'on ' + $routeParams.blockDate;
$scope.detail = 'On ' + $routeParams.blockDate;
}
if ($routeParams.startTimestamp) {
var d=new Date($routeParams.startTimestamp*1000);
var m=d.getMinutes();
if (m<10) m = '0' + m;
$scope.before = ' before ' + d.getHours() + ':' + m;
}
$rootScope.titleDetail = $scope.detail;
Blocks.get({
blockDate: $routeParams.blockDate
blockDate: $routeParams.blockDate,
startTimestamp: $routeParams.startTimestamp
}, function(res) {
$scope.loading = false;
$scope.blocks = res.blocks;

View File

@ -30,7 +30,7 @@
<div class="page-header">
<h1>
Blocks
<small>by date</small>
<small>by date. {{detail}} {{before}}</small>
</h1>
</div>
<table class="table table-hover table-striped">
@ -56,6 +56,10 @@
</tr>
</tbody>
</table>
<div data-ng-if="pagination.more">
<a class="btn btn-primary" href="/blocks-date/{{pagination.current}}" data-ng-show="{{before}}">Lastest block from date</a>
<a class="btn btn-primary" href="/blocks-date/{{pagination.current}}/{{pagination.moreTs}}">Older blocks from this date</a>
</div>
</div>
</div>
<h2 class="text-center text-muted" data-ng-show="!blocks.length && !loading">No blocks yet.</h2>