Fix SUP-725.
[mkws-moved-to-github.git] / src / mkws-widget-ru.js
1 mkws.registerWidgetType('reference-universe', function() {
2   if (!this.config.target) this.config.target = 'paratext_ruprime';
3   if (!this.config.perpage) this.config.perpage = 5;
4   if (!this.config.sort) this.config.sort = "position";
5   this.team.registerTemplate('reference-universe', '\
6 <h2>Results from Reference Universe</h2>\
7 <ul>\
8 {{#each hits}}\
9   <li>\
10     {{#mkws-first md-electronic-url}}\
11     <a href="{{this}}">\
12     {{/mkws-first}}\
13       {{md-title}}\
14     </a>\
15   {{#if md-title-remainder}}\
16     <span>{{md-title-remainder}}</span>\
17   {{/if}}\
18   {{#if md-title-responsibility}}\
19     <span><i>{{md-title-responsibility}}</i></span>\
20   {{/if}}\
21   </li>\
22 {{/each}}\
23 </ul>\
24 ');
25
26   var that = this;
27   var template = that.team.loadTemplate(that.config.template || "reference-universe");
28   this.team.queue("records").subscribe(function(data) {
29     that.node.html(template(data));
30   }); 
31   that.autosearch();
32 });
33