Merge pull request #8 from colkito/feature/blocklist-page
Blocklist page and blocklist by date page
This commit is contained in:
commit
7be0bb33e3
@ -51,7 +51,13 @@ exports.list = function(req, res) {
|
|||||||
var findParam = {};
|
var findParam = {};
|
||||||
|
|
||||||
if (req.query.blockDate) {
|
if (req.query.blockDate) {
|
||||||
findParam = {};
|
var gte = Math.round((new Date(req.query.blockDate)).getTime() / 1000);
|
||||||
|
var lte = gte + 86400;
|
||||||
|
|
||||||
|
findParam = { time: {
|
||||||
|
'$gte': gte,
|
||||||
|
'$lte': lte
|
||||||
|
}};
|
||||||
}
|
}
|
||||||
|
|
||||||
Block
|
Block
|
||||||
@ -67,3 +73,5 @@ exports.list = function(req, res) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -17,7 +17,7 @@ angular.module('mystery').config(['$routeProvider',
|
|||||||
templateUrl: 'views/blocks/list.html'
|
templateUrl: 'views/blocks/list.html'
|
||||||
}).
|
}).
|
||||||
when('/blocks-date/:blockDate', {
|
when('/blocks-date/:blockDate', {
|
||||||
templateUrl: 'views/blocks/list_date.html'
|
templateUrl: 'views/blocks/list.html'
|
||||||
}).
|
}).
|
||||||
otherwise({
|
otherwise({
|
||||||
redirectTo: '/'
|
redirectTo: '/'
|
||||||
|
|||||||
@ -3,13 +3,7 @@
|
|||||||
angular.module('mystery.blocks').controller('BlocksController', ['$scope', '$routeParams', '$location', 'Global', 'Block', 'Blocks', function ($scope, $routeParams, $location, Global, Block, Blocks) {
|
angular.module('mystery.blocks').controller('BlocksController', ['$scope', '$routeParams', '$location', 'Global', 'Block', 'Blocks', function ($scope, $routeParams, $location, Global, Block, Blocks) {
|
||||||
$scope.global = Global;
|
$scope.global = Global;
|
||||||
|
|
||||||
$scope.list_blocks = function() {
|
$scope.list = function() {
|
||||||
Blocks.query(function(blocks) {
|
|
||||||
$scope.blocks = blocks;
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.list_blocks_date = function() {
|
|
||||||
Blocks.query({
|
Blocks.query({
|
||||||
blockDate: $routeParams.blockDate
|
blockDate: $routeParams.blockDate
|
||||||
}, function(blocks) {
|
}, function(blocks) {
|
||||||
|
|||||||
@ -1,10 +1,17 @@
|
|||||||
<section data-ng-controller="BlocksController" data-ng-init="list_blocks()">
|
<section data-ng-controller="BlocksController" data-ng-init="list()">
|
||||||
<div class="page-header">
|
<div class="page-header">
|
||||||
<h1>Blocks by Date</h1>
|
<h1>Blocks by Date</h1>
|
||||||
</div>
|
</div>
|
||||||
<ul>
|
<table class="table table-striped">
|
||||||
<li data-ng-repeat="block in blocks">
|
<thead>
|
||||||
<span>{{block.hash}}</span> {{block.time}}
|
<th>Hash</th>
|
||||||
</li>
|
<th>Solved at</th>
|
||||||
</ul>
|
</thead>
|
||||||
</section>
|
<tbody>
|
||||||
|
<tr data-ng-repeat="block in blocks">
|
||||||
|
<td><a href="#!/block/{{block.hash}}">{{block.hash}}</a></td>
|
||||||
|
<td>{{block.time}}</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</section>
|
||||||
|
|||||||
@ -1,10 +0,0 @@
|
|||||||
<section data-ng-controller="BlocksController" data-ng-init="list_blocks_date()">
|
|
||||||
<div class="page-header">
|
|
||||||
<h1>Blocks by defined date</h1>
|
|
||||||
</div>
|
|
||||||
<ul>
|
|
||||||
<li data-ng-repeat="block in blocks">
|
|
||||||
<span>{{block.hash}}</span> {{block.time}}
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</section>
|
|
||||||
Loading…
Reference in New Issue
Block a user