89faa3df7a6028585bc06b3675b4fb3eae9ee665
[mkws-moved-to-github.git] / examples / htdocs / mkws-widget-wimp.js
1 var mkws_config = {
2    service_proxy_auth: "//sp-mkws.indexdata.com/service-proxy/?command=auth&action=login&username=wimp&password=wimp6363"
3 };
4
5 mkws.registerWidgetType('wimp', function() {
6   if (!this.config.perpage) this.config.perpage = 5;
7   if (!this.config.sort) this.config.sort = "position";
8   this.team.registerTemplate('wimp', '\
9 <h2>Results from Wimp</h2>\
10 <ul>\
11 {{#each hits}}\
12   <li>\
13     {{#mkws-first md-electronic-url}}\
14     <a href="{{this}}">\
15     {{/mkws-first}}\
16       {{md-title}}\
17     </a>\
18   {{#if md-title-remainder}}\
19     <span>{{md-title-remainder}}</span>\
20   {{/if}}\
21   {{#if md-title-responsibility}}\
22     <span><i>{{md-title-responsibility}}</i></span>\
23   {{/if}}\
24   </li>\
25 {{/each}}\
26 </ul>\
27 ');
28
29   var that = this;
30   var template = that.team.loadTemplate(that.config.template || "wimp");
31   this.team.queue("records").subscribe(function(data) {
32     that.node.html(template(data));
33   }); 
34   that.autosearch();
35 });
36