mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-21 05:53:33 -07:00
cleaned up template helpers
This commit is contained in:
parent
d7fbfec01e
commit
8841e43c25
17 changed files with 78 additions and 88 deletions
|
@ -1,18 +1,17 @@
|
|||
'use strict';
|
||||
define(
|
||||
[
|
||||
'handlebars',
|
||||
'sugar'
|
||||
], {
|
||||
register: function (handlebars) {
|
||||
handlebars.registerHelper('ShortDate', function (input) {
|
||||
if (!input) {
|
||||
return '';
|
||||
}
|
||||
], function (Handlebars) {
|
||||
Handlebars.registerHelper('ShortDate', function (input) {
|
||||
if (!input) {
|
||||
return '';
|
||||
}
|
||||
|
||||
var date = Date.create(input);
|
||||
var result = '<span title="' + date.full() + '">' + date.short() + '</span>';
|
||||
var date = Date.create(input);
|
||||
var result = '<span title="' + date.full() + '">' + date.short() + '</span>';
|
||||
|
||||
return new handlebars.SafeString(result);
|
||||
});
|
||||
}
|
||||
return new Handlebars.SafeString(result);
|
||||
});
|
||||
});
|
||||
|
|
10
UI/Handlebars/Helpers/Html.js
Normal file
10
UI/Handlebars/Helpers/Html.js
Normal file
|
@ -0,0 +1,10 @@
|
|||
'use strict';
|
||||
|
||||
define(
|
||||
[
|
||||
'handlebars'
|
||||
], function (Handlebars) {
|
||||
Handlebars.registerHelper('defaultImg', function () {
|
||||
return new Handlebars.SafeString('onerror="this.src="/content/images/poster-dark.jpg";"');
|
||||
});
|
||||
});
|
10
UI/Handlebars/Helpers/Numbers.js
Normal file
10
UI/Handlebars/Helpers/Numbers.js
Normal file
|
@ -0,0 +1,10 @@
|
|||
'use strict';
|
||||
define(
|
||||
[
|
||||
'handlebars',
|
||||
'Shared/FormatHelpers'
|
||||
], function (Handlebars, FormatHelpers) {
|
||||
Handlebars.registerHelper('Bytes', function (size) {
|
||||
return new Handlebars.SafeString(FormatHelpers.Bytes(size));
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue