From 33c1d995832c416a51883206435706e32f98a06c Mon Sep 17 00:00:00 2001 From: Marcin Kurczewski Date: Sat, 4 Oct 2014 22:46:28 +0200 Subject: [PATCH] Fixed loading templates from DOM --- gruntfile.js | 2 +- public_html/js/Promise.js | 5 +++-- public_html/js/Util.js | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/gruntfile.js b/gruntfile.js index f6d803f4..4abdbdbf 100644 --- a/gruntfile.js +++ b/gruntfile.js @@ -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; } diff --git a/public_html/js/Promise.js b/public_html/js/Promise.js index edbdb7c1..9633b690 100644 --- a/public_html/js/Promise.js +++ b/public_html/js/Promise.js @@ -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; } diff --git a/public_html/js/Util.js b/public_html/js/Util.js index b40c341d..8aa1b747 100644 --- a/public_html/js/Util.js +++ b/public_html/js/Util.js @@ -62,6 +62,7 @@ App.Util = function(_, jQuery, promise) { resolve(templateCache[templateName]); }); } + return null; } function promiseTemplateFromDOM(templateName) {