New file, mkws-widget-reference.js
[mkws-moved-to-github.git] / examples / htdocs / mkws-widget-reference.js
1 mkws.registerWidgetType('Reference', function() {
2     mkws.promotionFunction('Record').call(this);
3     if (!this.config.target) this.config.target = 'wikimedia_wikipedia_single_result';
4     if (!this.config.template) this.config.template = 'Reference';
5
6     this.team.registerTemplate('Reference', '\
7 <a href="{{md-electronic-url}}">\
8   <h1>{{md-title}}</h1>\
9 </a>\
10 {{#if md-title-remainder}}\
11   <b>{{md-title-remainder}}</b>\
12 {{/if}}\
13 {{#if md-title-responsibility}}\
14   <i>{{md-title-responsibility}}</i>\
15 {{/if}}\
16   <p>\
17     <img style="float:right; margin: 0 0 1em 3em" src="{{md-thumburl}}" alt="{{md-title}}">\
18     {{md-description}}\
19   </p>\
20 ');
21
22     var that = this;
23     this.team.queue("record").subscribe(function(data) {
24         that.log("got data " + $.toJSON(data));
25     });
26 });