From: Mike Taylor Date: Tue, 10 Jun 2014 10:19:38 +0000 (+0100) Subject: The loadTemplate function now takes an optional fallbackString X-Git-Tag: 1.0.0~510 X-Git-Url: http://git.indexdata.com/?p=mkws-moved-to-github.git;a=commitdiff_plain;h=9291dd10a58b20838e6e067bd9aefc29a4f827ef The loadTemplate function now takes an optional fallbackString argument, to be used when there is no HTML definition of the template (either in this team or in the global area), and the team has not registered a template of this name. The fallback string is used ahead of the global default. --- diff --git a/src/mkws-team.js b/src/mkws-team.js index 25a24d6..02dc5ac 100644 --- a/src/mkws-team.js +++ b/src/mkws-team.js @@ -386,7 +386,7 @@ function team($, teamName) { }; - function loadTemplate(name) { + function loadTemplate(name, fallbackString) { var template = m_template[name]; if (template === undefined) { @@ -400,10 +400,16 @@ function team($, teamName) { source = node.html(); } + // If the template is not defined in HTML, check the following + // in order: template registered in the team by a widget; + // fallback string provided on this invocation; global default. if (!source) { source = m_templateText[name]; } if (!source) { + source = fallbackString; + } + if (!source) { source = mkws.defaultTemplate(name); }