mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-21 05:53:33 -07:00
moved mixins to require.js
This commit is contained in:
parent
72772bed5a
commit
467c88f711
6 changed files with 81 additions and 89 deletions
30
UI/Handlebars/backbone.marionette.templates.js
Normal file
30
UI/Handlebars/backbone.marionette.templates.js
Normal file
|
@ -0,0 +1,30 @@
|
|||
"use strict";
|
||||
|
||||
define(['templates'], function (Templates) {
|
||||
return function () {
|
||||
this.get = function (templateId) {
|
||||
|
||||
var templateKey = templateId.toLowerCase();
|
||||
|
||||
var templateFunction = Templates[templateKey];
|
||||
|
||||
if (!templateFunction) {
|
||||
throw 'couldn\'t find pre-compiled template ' + templateKey;
|
||||
}
|
||||
|
||||
return function (data) {
|
||||
|
||||
try {
|
||||
return templateFunction(data);
|
||||
}
|
||||
catch (error) {
|
||||
console.error('template render failed for ' + templateKey + ' ' + error);
|
||||
console.error(data);
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
};
|
||||
};
|
||||
});
|
||||
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue