X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fmkws-team.js;h=bbeeb70764ec10c23a27e7898fdde588f1135e77;hb=99af6dcbe01c16dbcf77609dad7b369343343c58;hp=070f21df347c916820b9b25040d7d1288ed01bca;hpb=4abac12e93a06c15f6a805eef4e2c92db8d91ab1;p=mkws-moved-to-github.git diff --git a/src/mkws-team.js b/src/mkws-team.js index 070f21d..bbeeb70 100644 --- a/src/mkws-team.js +++ b/src/mkws-team.js @@ -164,14 +164,28 @@ mkws.makeTeam = function($, teamName) { }; params.oninit = onInit; - params.onbytarget = onBytarget; - params.onstat = onStat; - params.onterm = (config.facets.length ? onTerm : undefined); - params.onshow = onShow; - params.onrecord = onRecord; + if (m_queues.targets) { + params.onbytarget = onBytarget; + log("setting bytarget callback"); + } + if (m_queues.stat) { + params.onstat = onStat; + log("setting stat callback"); + } + if (m_queues.termlists && config.facets.length) { + params.onterm = onTerm; + log("setting term callback"); + } + if (m_queues.records) { + log("setting show callback"); + params.onshow = onShow; + // Record callback is subscribed from records callback + log("setting record callback"); + params.onrecord = onRecord; + } m_paz = new pz2(params); - log("ccreated main pz2 object"); + log("created main pz2 object"); } @@ -326,10 +340,10 @@ mkws.makeTeam = function($, teamName) { // switching view between targets and records function switchView(view) { - var targets = widgetNode('Targets'); - var results = widgetNode('Results') || widgetNode('Records'); - var blanket = widgetNode('Blanket'); - var motd = widgetNode('MOTD'); + var targets = widgetNode('targets'); + var results = widgetNode('results') || widgetNode('records'); + var blanket = widgetNode('blanket'); + var motd = widgetNode('motd'); switch(view) { case 'targets': @@ -411,7 +425,13 @@ mkws.makeTeam = function($, teamName) { var template = m_template[name]; if (template === undefined && Handlebars.compile) { var source; - var node = $(".mkwsTemplate_" + name + " .mkwsTeam_" + that.name()); + var node = $(".mkws-template-" + name + " .mkws-team-" + that.name()); + if (node && node.length < 1) { + node = $(".mkws-template-" + name); + } + if (node && node.length < 1) { + node = $(".mkwsTemplate_" + name + " .mkwsTeam_" + that.name()); + } if (node && node.length < 1) { node = $(".mkwsTemplate_" + name); } @@ -424,7 +444,7 @@ mkws.makeTeam = function($, teamName) { } //if (template === undefined) template = mkws_templatesbyteam[m_teamName][name]; if (template === undefined && Handlebars.templates) { - template = Handlebars.templates[name]; + template = Handlebars.templates["mkws-template-" + name]; } if (template === undefined && mkws.defaultTemplates) { template = mkws.defaultTemplates[name]; @@ -434,7 +454,7 @@ mkws.makeTeam = function($, teamName) { return template; } else { - mkws.log("No MKWS template for " + name); + log("No MKWS template for " + name); return null; } }