2013-03-30 00:00:38 +01:00
|
|
|
|
"use strict";
|
2013-02-15 04:10:03 +01:00
|
|
|
|
|
2013-03-30 00:00:38 +01:00
|
|
|
|
Marionette.TemplateCache.get = function (templateId) {
|
|
|
|
|
var templateFunction = window.Templates[templateId];
|
2013-02-15 04:10:03 +01:00
|
|
|
|
|
2013-03-30 00:00:38 +01:00
|
|
|
|
if (!templateFunction) {
|
|
|
|
|
console.error('couldn\'t find pre-compiled template ' + templateId);
|
2013-02-15 04:10:03 +01:00
|
|
|
|
}
|
|
|
|
|
|
2013-03-30 00:00:38 +01:00
|
|
|
|
var templateName = templateId;
|
2013-02-15 04:10:03 +01:00
|
|
|
|
|
2013-03-30 00:00:38 +01:00
|
|
|
|
return function (data) {
|
2013-02-15 04:10:03 +01:00
|
|
|
|
|
2013-03-30 00:00:38 +01:00
|
|
|
|
try {
|
2013-03-30 00:28:58 +01:00
|
|
|
|
//console.log('rendering template ' + templateName);
|
2013-03-30 00:00:38 +01:00
|
|
|
|
return templateFunction(data);
|
|
|
|
|
}
|
|
|
|
|
catch (error) {
|
|
|
|
|
console.error('template render failed for ' + templateName + ' ' + error.message);
|
|
|
|
|
console.error(data);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
};
|