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