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
*/
exports.show = function(req, res, next) {
exports.show = function(req, res) {
if (! req.query.q) {
res.status(400).send('Bad Request');

View File

@ -1,9 +1,20 @@
'use strict';
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;
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() {
Blocks.get({
blockDate: $routeParams.blockDate