2013-02-15 03:10:03 +00:00
|
|
|
|
_.extend(Marionette.TemplateCache.prototype, {
|
|
|
|
|
|
|
|
|
|
loadTemplate:function (templateId) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var template;
|
|
|
|
|
|
|
|
|
|
console.log("Loading template '" + templateId + "'");
|
|
|
|
|
|
|
|
|
|
$.ajax({
|
2013-02-18 02:10:21 +00:00
|
|
|
|
url:'static//' + templateId + '.html',
|
2013-02-15 03:10:03 +00:00
|
|
|
|
cache:false,
|
|
|
|
|
async:false
|
|
|
|
|
|
|
|
|
|
}).done(function (data) {
|
|
|
|
|
template = data;
|
|
|
|
|
|
|
|
|
|
}).fail(function (data) {
|
|
|
|
|
console.log("couldn't load template " + this.templateId + " Error: " + data.statusText);
|
|
|
|
|
template = "<div class='alert alert-error'>Couldn't load template '" + templateId + "'. Status: " + data.statusText + "</div>";
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return template;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
_.extend(Marionette.TemplateCache.prototype, {
|
|
|
|
|
|
|
|
|
|
compileTemplate:function (rawTemplate) {
|
|
|
|
|
return Handlebars.compile(rawTemplate);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|