Part of MKWS-348.
authorMike Taylor <mike@indexdata.com>
Mon, 12 Jan 2015 17:32:51 +0000 (17:32 +0000)
committerMike Taylor <mike@indexdata.com>
Mon, 12 Jan 2015 17:32:51 +0000 (17:32 +0000)
New file src/mkws-widget-ru.js, identical to old version in ../examples/htdocs

src/mkws-widget-ru.js [new file with mode: 0644]

diff --git a/src/mkws-widget-ru.js b/src/mkws-widget-ru.js
new file mode 100644 (file)
index 0000000..b616b33
--- /dev/null
@@ -0,0 +1,33 @@
+mkws.registerWidgetType('reference-universe', function() {
+  if (!this.config.target) this.config.target = 'paratext_ruprime';
+  if (!this.config.perpage) this.config.perpage = 5;
+  if (!this.config.sort) this.config.sort = "position";
+  this.team.registerTemplate('reference-universe', '\
+<h2>Results from Reference Universe</h2>\
+<ul>\
+{{#each hits}}\
+  <li>\
+    {{#mkws-first md-electronic-url}}\
+    <a href="{{this}}">\
+    {{/mkws-first}}\
+      {{md-title}}\
+    </a>\
+  {{#if md-title-remainder}}\
+    <span>{{md-title-remainder}}</span>\
+  {{/if}}\
+  {{#if md-title-responsibility}}\
+    <span><i>{{md-title-responsibility}}</i></span>\
+  {{/if}}\
+  </li>\
+{{/each}}\
+</ul>\
+');
+
+  var that = this;
+  var template = that.team.loadTemplate(that.config.template || "reference-universe");
+  this.team.queue("records").subscribe(function(data) {
+    that.node.html(template(data));
+  }); 
+  that.autosearch();
+});
+