mirror of
https://github.com/Radarr/Radarr.git
synced 2024-11-05 02:22:31 +01:00
207d9c256d
Relative dates for next airing on posters and list (series) History time shows real time on tooltip
54 lines
1.7 KiB
JavaScript
54 lines
1.7 KiB
JavaScript
'use strict';
|
|
|
|
define(
|
|
[
|
|
'Cells/NzbDroneCell',
|
|
'Shared/FormatHelpers'
|
|
], function (NzbDroneCell, FormatHelpers) {
|
|
return NzbDroneCell.extend({
|
|
|
|
className: 'episode-number-cell',
|
|
|
|
render: function () {
|
|
|
|
this.$el.empty();
|
|
|
|
var airDateField = this.column.get('airDate') || 'airDate';
|
|
var seasonField = this.column.get('seasonNumber') || 'seasonNumber';
|
|
var episodeField = this.column.get('episodes') || 'episodeNumber';
|
|
|
|
if (this.cellValue) {
|
|
|
|
var airDate = this.cellValue.get(airDateField);
|
|
var seasonNumber = this.cellValue.get(seasonField);
|
|
var episodes = this.cellValue.get(episodeField);
|
|
|
|
var result = 'Unknown';
|
|
|
|
if (episodes) {
|
|
|
|
var paddedEpisodes;
|
|
|
|
if (episodes.constructor === Array) {
|
|
paddedEpisodes = _.map(episodes,function (episodeNumber) {
|
|
return FormatHelpers.pad(episodeNumber, 2);
|
|
}).join();
|
|
}
|
|
else {
|
|
paddedEpisodes = FormatHelpers.pad(episodes, 2);
|
|
}
|
|
|
|
result = '{0}x{1}'.format(seasonNumber, paddedEpisodes);
|
|
}
|
|
else if (airDate) {
|
|
result = new Date(airDate).toLocaleDateString();
|
|
}
|
|
|
|
this.$el.html(result);
|
|
}
|
|
this.delegateEvents();
|
|
return this;
|
|
}
|
|
});
|
|
});
|