2013-01-22 05:40:26 +00:00
|
|
|
|
_.extend(Marionette.TemplateCache.prototype, {
|
|
|
|
|
|
|
|
|
|
loadTemplate: function (templateId) {
|
|
|
|
|
|
2013-01-22 05:48:06 +00:00
|
|
|
|
|
2013-01-22 05:43:47 +00:00
|
|
|
|
var template;
|
2013-01-22 05:40:26 +00:00
|
|
|
|
|
2013-01-22 05:48:06 +00:00
|
|
|
|
console.log("Loading template '" + templateId + "'");
|
|
|
|
|
|
2013-01-22 05:40:26 +00:00
|
|
|
|
jQuery.ajax({
|
2013-01-22 05:48:06 +00:00
|
|
|
|
url: '_backboneApp//' + templateId + '.html',
|
2013-01-25 17:54:45 +00:00
|
|
|
|
cache:false,
|
2013-01-22 05:40:26 +00:00
|
|
|
|
async: false
|
|
|
|
|
|
|
|
|
|
}).done(function (data) {
|
|
|
|
|
template = data;
|
|
|
|
|
|
|
|
|
|
}).fail(function (data) {
|
|
|
|
|
console.log("couldn't load template " + this.templateId + " Error: " + data.statusText);
|
2013-01-22 05:43:47 +00:00
|
|
|
|
template = "<div class='alert alert-error'>Couldn't load template '" + templateId + "'. Status: " + data.statusText + "</div>";
|
2013-01-22 05:40:26 +00:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return template;
|
|
|
|
|
}
|
2013-01-23 05:58:17 +00:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_.extend(Marionette.View.prototype, {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-01-22 05:40:26 +00:00
|
|
|
|
});
|