mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-14 02:37:08 -07:00
Removed mutators from EpisodeModel
This commit is contained in:
parent
83fe07524a
commit
e164df217d
8 changed files with 95 additions and 70 deletions
|
@ -4,15 +4,38 @@ define(
|
|||
'handlebars',
|
||||
'Shared/FormatHelpers'
|
||||
], function (Handlebars, FormatHelpers) {
|
||||
Handlebars.registerHelper('episodeNumberHelper', function () {
|
||||
Handlebars.registerHelper('EpisodeNumber', function () {
|
||||
|
||||
if (this.series.seriesType === 'daily') {
|
||||
return FormatHelpers.DateHelper(this.airDate);
|
||||
}
|
||||
|
||||
else {
|
||||
return '{0}x{1}'.format(this.seasonNumber, this.paddedEpisodeNumber);
|
||||
return '{0}x{1}'.format(this.seasonNumber, this.episodeNumber.pad(2));
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
Handlebars.registerHelper('StatusLevel', function () {
|
||||
|
||||
var hasFile = this.hasFile;
|
||||
var currentTime = Date.create();
|
||||
var start = Date.create(this.airDate);
|
||||
var end = Date.create(this.end);
|
||||
|
||||
if (currentTime.isBetween(start, end)) {
|
||||
return 'warning';
|
||||
}
|
||||
|
||||
if (start.isBefore(currentTime) && !hasFile) {
|
||||
return 'danger';
|
||||
}
|
||||
|
||||
if (hasFile) {
|
||||
return 'success';
|
||||
}
|
||||
|
||||
return 'primary';
|
||||
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue