RU widget linking directly and hardcoding target
[mkws-moved-to-github.git] / examples / htdocs / mkws-widget-ru.js
index 4b7054f..0fb6c67 100644 (file)
@@ -1,7 +1,23 @@
+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() {
-    //this.team.config.service_proxy_auth = "http://mkws.indexdata.com/service-proxy/?command=auth&action=login&username=paratext&password=paratext_mkc";
-    // this.team.config.perpage_default = 5;
-    // this.team.config.sort_default = "position";
-    this.node.html("<h2>Reference Universe results:</h2>\n" +
-                   this.subwidget('Records', { sort: 'position', perpage: 5 }));
+  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}}\
+');
+  this.node.html("<h2>Reference Universe results:</h2>\n" +
+                 this.subwidget('Records'));
 });