RU widget: use own template; be independent of records widget
authorJason Skomorowski <jason@indexdata.com>
Mon, 19 May 2014 21:27:34 +0000 (17:27 -0400)
committerJason Skomorowski <jason@indexdata.com>
Mon, 19 May 2014 22:57:52 +0000 (18:57 -0400)
examples/htdocs/mkws-widget-ru.css
examples/htdocs/mkws-widget-ru.html
examples/htdocs/mkws-widget-ru.js

index fa406fb..0d5c684 100644 (file)
@@ -17,11 +17,17 @@ h2 {
   padding-bottom: .5em;
 }
 
-.record, .mkwsSummary {
+ul {
+  margin: 0;
+  padding: 0;
+}
+
+li {
   margin: .95em .25em;
   padding-top: .75em;
   border-top: 1px dotted #BEC8CC;
   font-size: 90%;
+  list-style: none;
 }
 
 a {
index 64ef386..a457db5 100644 (file)
@@ -1,6 +1,7 @@
 <html>
   <div style="max-width: 18em; margin: 1.5em 1.5em">
-    <script src="//mkws.indexdata.com/mkws-complete.js"></script>
+    <!-- <script src="//mkws.indexdata.com/mkws&#45;complete.js"></script> -->
+    <script src="//mkws.local/src/mkws-complete.js"></script>
     <script src="mkws-widget-ru.js"></script>
     <link rel="stylesheet" type="text/css" href="mkws-widget-ru.css" />
     <div class="mkwsReferenceUniverse" autosearch="!param!q"></div>
index 0fb6c67..5185d05 100644 (file)
@@ -1,23 +1,33 @@
 var mkws_config = {service_proxy_auth: "http://mkws.indexdata.com/service-proxy/?command=auth&action=login&username=paratext&password=paratext_mkc"};
-console.log(JSON.stringify(mkws.config));
 
 mkws.registerWidgetType('ReferenceUniverse', function() {
   if (!this.config.perpage) this.config.perpage = 5;
   if (!this.config.sort) this.config.sort = "position";
-  this.config.template = 'ReferenceUniverse';
   this.team.registerTemplate('ReferenceUniverse', '\
-{{#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}}\
+<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>\
 ');
-  this.node.html("<h2>Reference Universe results:</h2>\n" +
-                 this.subwidget('Records'));
+
+  var that = this;
+  var template = that.team.loadTemplate(that.config.template || "ReferenceUniverse");
+  this.team.queue("records").subscribe(function(data) {
+    that.node.html(template(data));
+  }); 
+  widget.autosearch(that);
 });