Fixed loading templates from DOM
This commit is contained in:
parent
63878b27a1
commit
33c1d99583
3 changed files with 5 additions and 3 deletions
|
@ -32,7 +32,7 @@ function readTemplates(grunt) {
|
||||||
var templates = {};
|
var templates = {};
|
||||||
for (var i = 0; i < templatePaths.length; i ++) {
|
for (var i = 0; i < templatePaths.length; i ++) {
|
||||||
var templatePath = templatePaths[i];
|
var templatePath = templatePaths[i];
|
||||||
templates[path.basename(templatePath)] = fs.readFileSync(templatePath);
|
templates[path.basename(templatePath).replace('.tpl', '')] = fs.readFileSync(templatePath);
|
||||||
}
|
}
|
||||||
return templates;
|
return templates;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,13 +18,14 @@ App.Promise = function(_, jQuery) {
|
||||||
active = _.without(active, promise.promiseId);
|
active = _.without(active, promise.promiseId);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
active.push(promise.promiseId);
|
||||||
|
|
||||||
promise.then(function() {
|
promise.then(function() {
|
||||||
if (!_.contains(active, promise.promiseId)) {
|
if (!_.contains(active, promise.promiseId)) {
|
||||||
throw new Error('Broken promise');
|
throw new Error('Broken promise (promise ID: ' + promise.promiseId + ')');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
active.push(promise.promiseId);
|
|
||||||
return promise;
|
return promise;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -62,6 +62,7 @@ App.Util = function(_, jQuery, promise) {
|
||||||
resolve(templateCache[templateName]);
|
resolve(templateCache[templateName]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
function promiseTemplateFromDOM(templateName) {
|
function promiseTemplateFromDOM(templateName) {
|
||||||
|
|
Loading…
Reference in a new issue