From: Mike Taylor Date: Fri, 7 Feb 2014 15:05:31 +0000 (+0000) Subject: mkws.limitQuery() now accepts a team-name and delegates to the X-Git-Tag: 1.0.0~1502^2~20 X-Git-Url: http://sru.miketaylor.org.uk/cgi-bin?a=commitdiff_plain;h=a0495c501ec76cd2cbb99f0934d9b5106ed97413;p=mkws-moved-to-github.git mkws.limitQuery() now accepts a team-name and delegates to the appropriate team's member-function of the same name. --- diff --git a/tools/htdocs/mkws.js b/tools/htdocs/mkws.js index 52f8e73..980a5d2 100644 --- a/tools/htdocs/mkws.js +++ b/tools/htdocs/mkws.js @@ -67,7 +67,7 @@ Handlebars.registerHelper('commaList', function(items, options) { // Some functions are visible to be called from outside code, namely -// generated HTML: mkws.switchView(), showDetails(), limitTarget(), +// generated HTML: that.switchView(), showDetails(), limitTarget(), // limitQuery(), delimitTarget(), delimitQuery(), pagerPrev(), // pagerNext(), showPage(). Also mkws.M() is made available for the // Handlebars helper 'translate' @@ -358,7 +358,7 @@ function team($, teamName) { acc.push('target_id='+data[i].id+' '); action = 'mkws.limitTarget(\'' + m_teamName + '\', this.getAttribute(\'target_id\'),this.firstChild.nodeValue)'; } else { - action = 'mkws.limitQuery(\'' + pzIndex + '\', this.firstChild.nodeValue)'; + action = 'mkws.limitQuery(\'' + m_teamName + '\', \'' + pzIndex + '\', this.firstChild.nodeValue)'; } acc.push('onclick="' + action + ';return false;">' + data[i].name + '' + ' ' + data[i].freq + ''); @@ -543,7 +543,7 @@ function team($, teamName) { // limit the query after clicking the facet - mkws.limitQuery = function (field, value) + that.limitQuery = function (field, value) { debug("limitQuery(field=" + field + ", value=" + value + ")"); m_filters.push({ field: field, value: value }); @@ -1389,6 +1389,10 @@ function _mkws_jquery_plugin ($) { mkws.teams[tname].limitTarget(id, name); } + mkws.limitQuery = function (tname, field, value) { + mkws.teams[tname].limitQuery(field, value); + } + function default_mkws_config() { /* default mkws config */