mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-21 05:53:33 -07:00
Removed mutators from EpisodeModel
This commit is contained in:
parent
83fe07524a
commit
e164df217d
8 changed files with 95 additions and 70 deletions
|
@ -14,4 +14,33 @@ define(
|
|||
|
||||
return new Handlebars.SafeString(result);
|
||||
});
|
||||
|
||||
Handlebars.registerHelper('Day', function (input) {
|
||||
if (!input) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return Date.create(input).format('{dd}');
|
||||
});
|
||||
|
||||
Handlebars.registerHelper('Month', function (input) {
|
||||
if (!input) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return Date.create(input).format('{Mon}');
|
||||
});
|
||||
|
||||
Handlebars.registerHelper('StartTime', function (input) {
|
||||
if (!input) {
|
||||
return '';
|
||||
}
|
||||
|
||||
var date = Date.create(input);
|
||||
if (date.format('{mm}') === '00') {
|
||||
return date.format('{h}{tt}');
|
||||
}
|
||||
|
||||
return date.format('{h}.{mm}{tt}');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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';
|
||||
|
||||
});
|
||||
});
|
||||
|
|
|
@ -7,4 +7,8 @@ define(
|
|||
Handlebars.registerHelper('Bytes', function (size) {
|
||||
return new Handlebars.SafeString(FormatHelpers.Bytes(size));
|
||||
});
|
||||
|
||||
Handlebars.registerHelper('Pad2', function (input) {
|
||||
return input.pad(2);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -11,7 +11,7 @@ define(
|
|||
var profile = QualityProfileCollection.get(profileId);
|
||||
|
||||
if (profile) {
|
||||
return new Handlebars.SafeString('<span class="label quality-profile-lable">' + profile.get("name") + '</span>');
|
||||
return new Handlebars.SafeString('<span class="label quality-profile-label">' + profile.get("name") + '</span>');
|
||||
}
|
||||
|
||||
return undefined;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue