go to block using height value. url is: /block-index/<height>

This commit is contained in:
Gustavo Cortez 2014-01-20 18:53:24 -03:00
parent ef0b558ed9
commit 4291af0cc3
2 changed files with 13 additions and 2 deletions

View File

@ -10,7 +10,7 @@ var Status = require('../models/Status'),
/** /**
* Status * Status
*/ */
exports.show = function(req, res, next) { exports.show = function(req, res) {
if (! req.query.q) { if (! req.query.q) {
res.status(400).send('Bad Request'); res.status(400).send('Bad Request');

View File

@ -1,9 +1,20 @@
'use strict'; 'use strict';
angular.module('insight.blocks').controller('BlocksController', angular.module('insight.blocks').controller('BlocksController',
function ($scope, $rootScope, $routeParams, $location, Global, Block, Blocks) { function ($scope, $rootScope, $routeParams, $location, Global, Block, Blocks, BlockByHeight) {
$scope.global = Global; $scope.global = Global;
if ($routeParams.blockHeight) {
BlockByHeight.get({
blockHeight: $routeParams.blockHeight
}, function(hash) {
$location.path('/block/' + hash.blockHash);
}, function() {
$rootScope.flashMessage = 'Bad Request';
$location.path('/');
});
}
$scope.list = function() { $scope.list = function() {
Blocks.get({ Blocks.get({
blockDate: $routeParams.blockDate blockDate: $routeParams.blockDate