Template Stat widget
authorJason Skomorowski <jason@indexdata.com>
Tue, 5 Aug 2014 14:27:00 +0000 (10:27 -0400)
committerJason Skomorowski <jason@indexdata.com>
Tue, 5 Aug 2014 14:27:00 +0000 (10:27 -0400)
src/mkws-widget-main.js
src/mkws-widget-main.templates/Stat.handlebars [new file with mode: 0644]

index 224595e..91c2d93 100644 (file)
@@ -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(' -- ' +
-                      '<span class="mkwsClientCount">' + M('Active clients') + ': ' + data.activeclients + '/' + data.clients + '</span>' +
-                      ' -- ' +
-                      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 (file)
index 0000000..f62b8e3
--- /dev/null
@@ -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
+}}
+ -- <span class="mkwsClientCount">{{mkws-translate "Active clients"}} : {{activeclients}}/{{clients}}</span> -- {{mkws-translate "Retrieved records"}} : {{records}}/{{hits}}