mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-21 05:53:33 -07:00
Helper cleanup
This commit is contained in:
parent
1fb944976e
commit
626d48c8ea
16 changed files with 89 additions and 83 deletions
|
@ -1,24 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
Handlebars.registerHelper('partial', function (templateName) {
|
||||
//TODO: We should be able to pass in the context, either an object or a property
|
||||
|
||||
var templateFunction = Marionette.TemplateCache.get(templateName);
|
||||
return new Handlebars.SafeString(templateFunction(this));
|
||||
});
|
||||
|
||||
Handlebars.registerHelper("debug", function(optionalValue) {
|
||||
console.log("Current Context");
|
||||
console.log("====================");
|
||||
console.log(this);
|
||||
|
||||
if (optionalValue) {
|
||||
console.log("Value");
|
||||
console.log("====================");
|
||||
console.log(optionalValue);
|
||||
}
|
||||
});
|
||||
|
||||
Handlebars.registerHelper("fileSize", function(size) {
|
||||
return size.bytes(1);
|
||||
});
|
|
@ -1,29 +0,0 @@
|
|||
"use strict";
|
||||
|
||||
//TODO: global function, not good!
|
||||
function bestDateString(sourceDate) {
|
||||
if (!sourceDate) {
|
||||
return '';
|
||||
}
|
||||
|
||||
var date = Date.create(sourceDate);
|
||||
|
||||
if (date.isYesterday()) {
|
||||
return 'Yesterday';
|
||||
}
|
||||
if (date.isToday()) {
|
||||
return 'Today';
|
||||
}
|
||||
if (date.isTomorrow()) {
|
||||
return 'Tomorrow';
|
||||
}
|
||||
if (date.isAfter(Date.create('tomorrow')) && date.isBefore(Date.create().addDays(7))) {
|
||||
return date.format('{Weekday}');
|
||||
}
|
||||
|
||||
if (date.isAfter(Date.create().addDays(6))) {
|
||||
return date.relative().replace(' from now', '');
|
||||
}
|
||||
|
||||
return date.format('{MM}/{dd}/{yyyy}');
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue