diff --git a/app/views/includes/head.jade b/app/views/includes/head.jade index a3ed958..80bef44 100755 --- a/app/views/includes/head.jade +++ b/app/views/includes/head.jade @@ -4,7 +4,7 @@ head meta(name='viewport', content='width=device-width,initial-scale=1.0') meta(name="fragment", content="!") - title= appName+' - '+title + title(data-ng-bind="$root.title + $root.titleDetail + ' | #{appName}'")= appName meta(http-equiv='Content-type', content='text/html;charset=UTF-8') meta(name="keywords", content="node.js, express, mongoose, mongodb, angularjs") meta(name="description", content="Insight") diff --git a/app/views/layouts/default.jade b/app/views/layouts/default.jade index 5b33854..c62f609 100755 --- a/app/views/layouts/default.jade +++ b/app/views/layouts/default.jade @@ -1,7 +1,7 @@ doctype html -html(lang='en', xmlns='http://www.w3.org/1999/xhtml') +html(lang='en', xmlns='http://www.w3.org/1999/xhtml', data-ng-app='insight') include ../includes/head - body(data-ng-app='insight') + body #wrap include ../includes/navbar block content diff --git a/public/js/config.js b/public/js/config.js index 5fe4e68..3673cbe 100755 --- a/public/js/config.js +++ b/public/js/config.js @@ -1,44 +1,56 @@ 'use strict'; //Setting up route -angular.module('insight').config(['$routeProvider', - function($routeProvider) { - $routeProvider. +angular.module('insight').config(function($routeProvider) { + $routeProvider. when('/block/:blockHash', { - templateUrl: '/views/block.html' + templateUrl: '/views/block.html', + title: 'Bitcoin Block ' }). when('/block-index/:blockHeight', { controller: 'BlocksController', templateUrl: '/views/redirect.html' }). when('/tx/:txId', { - templateUrl: '/views/transaction.html' + templateUrl: '/views/transaction.html', + title: 'Bitcoin Transaction ' }). when('/', { - templateUrl: '/views/index.html' + templateUrl: '/views/index.html', + title: 'Home' }). when('/blocks', { - templateUrl: '/views/blocks/list.html' + templateUrl: '/views/blocks/list.html', + title: 'Bitcoin Blocks solved Today' }). when('/blocks-date/:blockDate', { - templateUrl: '/views/blocks/list.html' + templateUrl: '/views/blocks/list.html', + title: 'Bitcoin Blocks solved ' }). when('/address/:addrStr', { - templateUrl: '/views/address.html' + templateUrl: '/views/address.html', + title: 'Bitcoin Address ' }). when('/status', { - templateUrl: '/views/status.html' + templateUrl: '/views/status.html', + title: 'Status' }). otherwise({ - templateUrl: '/views/404.html' + templateUrl: '/views/404.html', + title: 'Error' }); - } -]); +}); //Setting HTML5 Location Mode -angular.module('insight').config(['$locationProvider', - function($locationProvider) { +angular.module('insight') + .config(function($locationProvider) { $locationProvider.html5Mode(true); $locationProvider.hashPrefix('!'); - } -]); + }) + .run(function($rootScope, $route) { + $rootScope.$on('$routeChangeSuccess', function() { + //Change page title, based on Route information + $rootScope.titleDetail = ''; + $rootScope.title = $route.current.title; + }); + }); diff --git a/public/js/controllers/address.js b/public/js/controllers/address.js index 9b46cba..4f7005b 100644 --- a/public/js/controllers/address.js +++ b/public/js/controllers/address.js @@ -5,6 +5,8 @@ function($scope, $rootScope, $routeParams, $location, Global, Address, getSocket $scope.global = Global; $scope.findOne = function() { + $rootScope.titleDetail = $routeParams.addrStr; + Address.get({ addrStr: $routeParams.addrStr }, diff --git a/public/js/controllers/blocks.js b/public/js/controllers/blocks.js index cbd2871..21cdd44 100644 --- a/public/js/controllers/blocks.js +++ b/public/js/controllers/blocks.js @@ -19,6 +19,10 @@ angular.module('insight.blocks').controller('BlocksController', $scope.list = function() { $scope.loading = true; + if ($routeParams.blockDate) { + $rootScope.titleDetail = 'on ' + $routeParams.blockDate; + } + Blocks.get({ blockDate: $routeParams.blockDate }, function(res) { @@ -30,6 +34,7 @@ angular.module('insight.blocks').controller('BlocksController', $scope.findOne = function() { $scope.loading = true; + $rootScope.titleDetail = $routeParams.blockHash; Block.get({ blockHash: $routeParams.blockHash diff --git a/public/js/controllers/transactions.js b/public/js/controllers/transactions.js index 0fcbbcb..3a979a0 100644 --- a/public/js/controllers/transactions.js +++ b/public/js/controllers/transactions.js @@ -104,11 +104,7 @@ function($scope, $rootScope, $routeParams, $location, Global, Transaction, Trans }); }; - $scope.findThis = function() { - $scope.findTx($routeParams.txId); - }; - - $scope.findTx = function(txid) { + var _findTx = function(txid) { Transaction.get({ txId: txid }, function(tx) { @@ -130,6 +126,11 @@ function($scope, $rootScope, $routeParams, $location, Global, Transaction, Trans }); }; + $scope.findThis = function() { + $rootScope.titleDetail = $routeParams.txId; + _findTx($routeParams.txId); + }; + //Initial load $scope.load = function(from) { $scope.loadedBy = from; @@ -154,7 +155,7 @@ function($scope, $rootScope, $routeParams, $location, Global, Transaction, Trans $scope.txs = []; $scope.$on('tx', function(event, txid) { - $scope.findTx(txid); + _findTx(txid); }); }); diff --git a/public/js/init.js b/public/js/init.js index d0da1d0..53aa43f 100755 --- a/public/js/init.js +++ b/public/js/init.js @@ -2,5 +2,5 @@ angular.element(document).ready(function() { // Init the app - angular.bootstrap(document, ['insight']); + // angular.bootstrap(document, ['insight']); });