X-Git-Url: http://git.indexdata.com/?p=mkws-moved-to-github.git;a=blobdiff_plain;f=src%2Fmkws-widget-record.js;h=ad624259d077819e24962ebd777262bd7fccdc5d;hp=3d15fbcf98befd6788d7bbe9ee5328ed5a948bbf;hb=ff4ef5a862a96d76c8a52557452105e9757a58af;hpb=60901794c7d0bd2213f7c002d158a44ea129b576 diff --git a/src/mkws-widget-record.js b/src/mkws-widget-record.js index 3d15fbc..ad62425 100644 --- a/src/mkws-widget-record.js +++ b/src/mkws-widget-record.js @@ -1,4 +1,32 @@ -mkws.registerWidgetType('Record', function() { - mkws.promotionFunction('Records').call(this); - this.config.perpage = 1; +// A widget for a record-list of a single record +mkws.registerWidgetType('record', function() { + if (!this.config.maxrecs) this.config.maxrecs = 1; + var that = this; + var team = this.team; + team.queue("records").subscribe(function(data) { + var template = team.loadTemplate(that.config.template || "details"); + var targs = mkws.$.extend({}, data.hits[0], that.config.template_vars); + that.node.html(template(targs)); + }); + that.autosearch(); +}); + +mkws.registerWidgetType('images', function() { + mkws.promotionFunction('records').call(this); + if (!this.config.template) this.config.template = 'images'; +}); + +mkws.registerWidgetType('google-image', function() { + mkws.promotionFunction('images').call(this); + if (!this.config.target) this.config.target = 'Google_Images'; +}); + +mkws.registerWidgetType('lolcat', function() { + mkws.promotionFunction('google-image').call(this); + if (!this.config.autosearch) this.config.autosearch = 'kitteh'; +}); + +mkws.registerWidgetType('cover-art', function() { + mkws.promotionFunction('images').call(this); + if (!this.config.target) this.config.target = 'AmazonBooks'; });