From: Mike Taylor Date: Tue, 10 Jun 2014 15:06:55 +0000 (+0100) Subject: Generate individual facets using a template rather than code. X-Git-Tag: 1.0.0~500 X-Git-Url: http://jsfdemo.indexdata.com/cgi-bin?a=commitdiff_plain;h=70318a73321ecf3b5fbfd159ff44bdc5f5d6a63d;p=mkws-moved-to-github.git Generate individual facets using a template rather than code. --- diff --git a/src/mkws-widget-termlists.js b/src/mkws-widget-termlists.js index cb07b28..4823d2c 100644 --- a/src/mkws-widget-termlists.js +++ b/src/mkws-widget-termlists.js @@ -56,15 +56,16 @@ mkws.registerWidgetType('Facet', function() { fn = 'limitTarget'; datum = data[i].id; } - var action = ''; - if (fn) { - action = 'mkws.' + fn + '(\'' + teamName + '\', \'' + datum + '\', \'' + data[i].name + '\')'; - } - - acc.push('
', - '', data[i].name, '', - '', data[i].freq, '', - '
'); + var template = that.team.loadTemplate('Facet'); + var s = template({ + team: teamName, + fn: fn, + field: datum, + term: data[i].name, + count: data[i].freq, + query: that.config.query + }); + acc.push('
', s, '
'); } that.node.html(acc.join(''));