Merge branch 'MDL-64181-34' of git://github.com/damyon/moodle into MOODLE_34_STABLE
This commit is contained in:
Vendored
+1
-1
File diff suppressed because one or more lines are too long
@@ -656,9 +656,10 @@ define([
|
||||
* @param {string} templateName - should consist of the component and the name of the template like this:
|
||||
* core/menu (lib/templates/menu.mustache) or
|
||||
* tool_bananas/yellow (admin/tool/bananas/templates/yellow.mustache)
|
||||
* @param {Array} parentage - A list of requested partials in this render chain.
|
||||
* @return {Promise} JQuery promise object resolved when all partials are in the cache.
|
||||
*/
|
||||
Renderer.prototype.cachePartials = function(templateName) {
|
||||
Renderer.prototype.cachePartials = function(templateName, parentage) {
|
||||
var searchKey = this.currentThemeName + '/' + templateName;
|
||||
|
||||
if (searchKey in cachePartialPromises) {
|
||||
@@ -667,6 +668,9 @@ define([
|
||||
|
||||
// This promise will not be resolved until all child partials are also resolved and ready.
|
||||
// We create it here to allow us to check for recursive inclusion of templates.
|
||||
// Keep track of the requested partials in this chain.
|
||||
parentage = parentage || [];
|
||||
|
||||
cachePartialPromises[searchKey] = $.Deferred();
|
||||
|
||||
this.getTemplate(templateName)
|
||||
@@ -675,8 +679,8 @@ define([
|
||||
var uniquePartials = partials.filter(function(partialName) {
|
||||
// Check for recursion.
|
||||
|
||||
if (typeof cachePartialPromises[this.currentThemeName + '/' + partialName] !== 'undefined') {
|
||||
// Ignore templates which include their parent.
|
||||
if (parentage.indexOf(this.currentThemeName + '/' + partialName) >= 0) {
|
||||
// Ignore templates which include a parent template already requested in the current chain.
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -686,7 +690,8 @@ define([
|
||||
|
||||
// Fetch any partial which has not already been fetched.
|
||||
var fetchThemAll = uniquePartials.map(function(partialName) {
|
||||
return this.cachePartials(partialName);
|
||||
parentage.push(this.currentThemeName + '/' + partialName);
|
||||
return this.cachePartials(partialName, parentage);
|
||||
}.bind(this));
|
||||
|
||||
// Resolve the templateName promise when all of the children are resolved.
|
||||
|
||||
Reference in New Issue
Block a user