From 9d552877ef9bfbb92887942b9ac1870ddd12ba58 Mon Sep 17 00:00:00 2001 From: Jason Skomorowski Date: Tue, 5 Aug 2014 10:27:00 -0400 Subject: [PATCH] Template Stat widget --- src/mkws-widget-main.js | 8 ++------ src/mkws-widget-main.templates/Stat.handlebars | 9 +++++++++ 2 files changed, 11 insertions(+), 6 deletions(-) create mode 100644 src/mkws-widget-main.templates/Stat.handlebars diff --git a/src/mkws-widget-main.js b/src/mkws-widget-main.js index 224595e..91c2d93 100644 --- a/src/mkws-widget-main.js +++ b/src/mkws-widget-main.js @@ -31,13 +31,9 @@ mkws.registerWidgetType('Targets', function() { mkws.registerWidgetType('Stat', function() { var that = this; - var M = mkws.M; - this.team.queue("stat").subscribe(function(data) { - that.node.html(' -- ' + - '' + M('Active clients') + ': ' + data.activeclients + '/' + data.clients + '' + - ' -- ' + - M('Retrieved records') + ': ' + data.records + '/' + data.hits); + var template = that.team.loadTemplate(that.config.template || "Stat"); + that.node.html(template(data)); }); }); diff --git a/src/mkws-widget-main.templates/Stat.handlebars b/src/mkws-widget-main.templates/Stat.handlebars new file mode 100644 index 0000000..f62b8e3 --- /dev/null +++ b/src/mkws-widget-main.templates/Stat.handlebars @@ -0,0 +1,9 @@ +{{! +Search statistics + +activeclients - number of targets currently searching +clients - total targets for this search +records - number of records returned and available +hits - number of hits across all targets +}} + -- {{mkws-translate "Active clients"}} : {{activeclients}}/{{clients}} -- {{mkws-translate "Retrieved records"}} : {{records}}/{{hits}} -- 1.7.10.4