Browse Source

reusing the blocklist template. Parsing new model

generic-ui
Mario Colque 11 years ago
parent
commit
100b901581
  1. 2
      public/js/config.js
  2. 8
      public/js/controllers/blocks.js
  3. 21
      public/views/blocks/list.html
  4. 10
      public/views/blocks/list_date.html

2
public/js/config.js

@ -14,7 +14,7 @@ angular.module('mystery').config(['$routeProvider',
templateUrl: 'views/blocks/list.html'
}).
when('/blocks-date/:blockDate', {
templateUrl: 'views/blocks/list_date.html'
templateUrl: 'views/blocks/list.html'
}).
otherwise({
redirectTo: '/'

8
public/js/controllers/blocks.js

@ -3,13 +3,7 @@
angular.module('mystery.blocks').controller('BlocksController', ['$scope', '$routeParams', '$location', 'Global', 'Block', 'Blocks', function ($scope, $routeParams, $location, Global, Block, Blocks) {
$scope.global = Global;
$scope.list_blocks = function() {
Blocks.query(function(blocks) {
$scope.blocks = blocks;
});
};
$scope.list_blocks_date = function() {
$scope.list = function() {
Blocks.query({
blockDate: $routeParams.blockDate
}, function(blocks) {

21
public/views/blocks/list.html

@ -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">
<h1>Blocks by Date</h1>
</div>
<ul>
<li data-ng-repeat="block in blocks">
<span>{{block.hash}}</span> {{block.time}}
</li>
</ul>
</section>
<table class="table table-striped">
<thead>
<th>Hash</th>
<th>Solved at</th>
</thead>
<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>

10
public/views/blocks/list_date.html

@ -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…
Cancel
Save