Fixed loading templates from DOM

This commit is contained in:
Marcin Kurczewski 2014-10-04 22:46:28 +02:00
parent 63878b27a1
commit 33c1d99583
3 changed files with 5 additions and 3 deletions

View file

@ -32,7 +32,7 @@ function readTemplates(grunt) {
var templates = {};
for (var i = 0; i < templatePaths.length; i ++) {
var templatePath = templatePaths[i];
templates[path.basename(templatePath)] = fs.readFileSync(templatePath);
templates[path.basename(templatePath).replace('.tpl', '')] = fs.readFileSync(templatePath);
}
return templates;
}

View file

@ -18,13 +18,14 @@ App.Promise = function(_, jQuery) {
active = _.without(active, promise.promiseId);
});
active.push(promise.promiseId);
promise.then(function() {
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;
}

View file

@ -62,6 +62,7 @@ App.Util = function(_, jQuery, promise) {
resolve(templateCache[templateName]);
});
}
return null;
}
function promiseTemplateFromDOM(templateName) {