Permalink
Browse files

Revert "Merge branch 'MDL-54915-31' of git://github.com/andrewnicols/…

…moodle into MOODLE_31_STABLE"

This reverts commit f1ec07f, reversing
changes made to 1972614.
  • Loading branch information...
danpoltawski committed Jul 19, 2016
1 parent ca8cef5 commit f8e748dd4d3025446e89f5528fdeb6412ae19070
Showing with 10 additions and 7 deletions.
  1. +1 −1 lib/amd/build/templates.min.js
  2. +9 −6 lib/amd/src/templates.js

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -45,6 +45,9 @@ define([ 'core/mustache',
/** @var {string[]} requiredStrings - Collection of strings found during the rendering of one template */
var requiredStrings = [];
/** @var {string[]} requiredJS - Collection of js blocks found during the rendering of one template */
var requiredJS = [];
/** @var {Number} uniqid Incrementing value that is changed for every call to render */
var uniqid = 1;
@@ -178,7 +181,7 @@ define([ 'core/mustache',
* @return {string}
*/
var jsHelper = function(sectionText, helper) {
this.jsBlocks.push(helper(sectionText, this));
requiredJS.push(helper(sectionText, this));
return '';
};
@@ -254,11 +257,11 @@ define([ 'core/mustache',
var addHelpers = function(context, themeName) {
currentThemeName = themeName;
requiredStrings = [];
requiredJS = [];
context.uniqid = uniqid++;
context.str = function() { return stringHelper; };
context.pix = function() { return pixHelper; };
context.js = function() { return jsHelper; };
context.jsBlocks = [];
context.quote = function() { return quoteHelper; };
context.globals = { config : config };
context.currentTheme = themeName;
@@ -274,8 +277,8 @@ define([ 'core/mustache',
*/
var getJS = function(strings) {
var js = '';
if (this.jsBlocks.length > 0) {
js = this.jsBlocks.join(";\n");
if (requiredJS.length > 0) {
js = requiredJS.join(";\n");
}
// Re-render to get the final strings.
@@ -391,11 +394,11 @@ define([ 'core/mustache',
// and cause the template to die on the second pass (unbalanced).
result = treatStringsInContent(result, strings);
deferred.resolve(result, getJS.bind(context)(strings));
deferred.resolve(result, getJS(strings));
})
.fail(deferred.reject);
} else {
deferred.resolve(result.trim(), getJS.bind(context)([]));
deferred.resolve(result.trim(), getJS([]));
}
}
).fail(deferred.reject);

0 comments on commit f8e748d

Please sign in to comment.