From 11158060bf6d7de7a09ca39839ae87a276b23209 Mon Sep 17 00:00:00 2001 From: Marian Oancea Date: Thu, 5 Feb 2015 10:27:12 +0200 Subject: [PATCH] added location tooltip --- public/js/controllers.js | 1 - public/js/filters.js | 4 ++++ public/js/script.js | 6 +++++- views/index.jade | 3 ++- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/public/js/controllers.js b/public/js/controllers.js index 4282f85..237713c 100644 --- a/public/js/controllers.js +++ b/public/js/controllers.js @@ -25,6 +25,5 @@ function StatsCtrl($scope, socket, _) { $scope.nodesActive = _.filter($scope.nodes, function(node){ return node.stats.active == true; }).length; $scope.bestBlock = _.max($scope.nodes, function(node){ return parseInt(node.stats.block.height); }).stats.block.height; $scope.lastBlock = _.max($scope.nodes, function(node){ return parseInt(node.stats.block.timestamp); }).stats.block.timestamp; - $scope.apply(); } } \ No newline at end of file diff --git a/public/js/filters.js b/public/js/filters.js index d4cdd48..12268bc 100644 --- a/public/js/filters.js +++ b/public/js/filters.js @@ -54,6 +54,10 @@ angular.module('netStatsApp.filters', []) return function(timestamp) { return timeClass(timestamp); }; +}).filter('geoTooltip', function() { + return function(geo) { + return geo.city + ", " + geo.country; + }; }); function peerClass(peers) diff --git a/public/js/script.js b/public/js/script.js index c5eb46e..af28d3e 100644 --- a/public/js/script.js +++ b/public/js/script.js @@ -80,5 +80,9 @@ console.log(data); }); - $('[data-toggle="tooltip"]').tooltip(); + $('body').on('mouseenter', '[data-toggle="tooltip"]', function( event ) { + $(this).tooltip('show'); + }).on('mouseleave', '[data-toggle="tooltip"]', function( event ) { + $(this).tooltip('hide'); + }) })(); \ No newline at end of file diff --git a/views/index.jade b/views/index.jade index 1e9be6e..f01d72f 100644 --- a/views/index.jade +++ b/views/index.jade @@ -74,7 +74,8 @@ block content i.icon-clock(data-toggle="tooltip", data-placement="top", title="Up-time") tbody tr(ng-repeat='node in nodes', class="{{ node.stats | mainClass : bestBlock }}") - td(rel="{{node.id}}") {{node.name}} + td(rel="{{node.id}}") + span(data-toggle="tooltip", data-placement="top", data-original-title="{{node.geo | geoTooltip}}") {{node.name}} td {{node.type}} td(class="{{ node.stats.peers | peerClass }}") {{node.stats.peers}} td(class="{{ node.stats.mining | miningClass }}")