You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Radarr/NzbDrone.Backbone/Mixins/backbone.marionette.templat...

38 lines
960 B

_.extend(Marionette.TemplateCache.prototype, {
loadTemplate:function (templateId) {
var template;
console.log("Loading template '" + templateId + "'");
if (templateId.startsWith('#')) {
return $(templateId).html();
}
$.ajax({
url:'/static/' + templateId + '.html',
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);
}
});