mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-12-16 11:37:58 +02:00
fixed calendar view
This commit is contained in:
parent
70cfa5e685
commit
aca5d1f361
@ -13,6 +13,11 @@ public object FromDB(ColumnMap map, object dbValue)
|
||||
|
||||
public object ToDB(object clrValue)
|
||||
{
|
||||
if (clrValue == DBNull.Value)
|
||||
{
|
||||
return clrValue;
|
||||
}
|
||||
|
||||
var dateTime = (DateTime)clrValue;
|
||||
return dateTime.ToUniversalTime();
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ define(['app', 'Calendar/Collection'], function () {
|
||||
success: function (calendarCollection) {
|
||||
_.each(calendarCollection.models, function (element) {
|
||||
var episodeTitle = element.get('title');
|
||||
var seriesTitle = element.get('series').title;
|
||||
var seriesTitle = element.get('series').get('title');
|
||||
var start = element.get('airDate');
|
||||
|
||||
element.set('title', seriesTitle);
|
||||
|
@ -3,7 +3,7 @@
|
||||
<h1>{{day}}</h1>
|
||||
<h4>{{month}}</h4>
|
||||
</div>
|
||||
<a href="/series/details/{{series.titleSlug}}">
|
||||
<a href="{{series.route}}">
|
||||
<h4>{{series.title}}</h4>
|
||||
</a>
|
||||
<p>{{startTime}} {{date airDate}}<span class="pull-right">{{seasonNumber}}x{{paddedEpisodeNumber}}</span><br>{{episodeTitle}}</p>
|
||||
|
@ -7,26 +7,41 @@ define(['app', 'Cells/NzbDroneCell'], function () {
|
||||
|
||||
render: function () {
|
||||
|
||||
var airDate = this.cellValue.get('airDate') || this.get(this.column.get("airDate"));
|
||||
var seasonNumber = this.cellValue.get('seasonNumber') || this.model.get(this.column.get("seasonNumber"));
|
||||
var episodes = this.cellValue.get('episodeNumber') || this.model.get(this.column.get("episodes"));
|
||||
this.$el.empty();
|
||||
|
||||
var result = 'Unknown';
|
||||
var airDateField = this.column.get('airDate') || 'airDate';
|
||||
var seasonFiled = this.column.get('seasonNumber') || 'seasonNumber';
|
||||
var episodeFiled = this.column.get('episodes') || 'episodeNumber';
|
||||
|
||||
if (airDate) {
|
||||
if (this.cellValue) {
|
||||
|
||||
result = new Date(airDate).toLocaleDateString();
|
||||
var airDate = this.cellValue.get(airDateField);
|
||||
var seasonNumber = this.cellValue.get(seasonFiled);
|
||||
var episodes = this.cellValue.get(episodeFiled);
|
||||
|
||||
var result = 'Unknown';
|
||||
|
||||
if (episodes) {
|
||||
|
||||
var paddedEpisodes;
|
||||
|
||||
if (episodes.constructor === Array) {
|
||||
paddedEpisodes = _.map(episodes,function (episodeNumber) {
|
||||
return episodeNumber.pad(2);
|
||||
}).join();
|
||||
}
|
||||
else {
|
||||
paddedEpisodes = episodes.pad(2);
|
||||
}
|
||||
|
||||
result = 'S{0}-E{1}'.format(seasonNumber.pad(2), paddedEpisodes);
|
||||
}
|
||||
else if (airDate) {
|
||||
result = new Date(airDate).toLocaleDateString();
|
||||
}
|
||||
|
||||
this.$el.html(result);
|
||||
}
|
||||
else {
|
||||
|
||||
var paddedEpisodes = _.map(episodes, function (episodeNumber) {
|
||||
return episodeNumber.pad(2);
|
||||
});
|
||||
|
||||
result = 'S{0}-E{1}'.format(seasonNumber, paddedEpisodes.join());
|
||||
}
|
||||
|
||||
this.$el.html(result);
|
||||
this.delegateEvents();
|
||||
return this;
|
||||
}
|
||||
|
@ -28,9 +28,13 @@ define(['app'], function () {
|
||||
|
||||
var value = this.model.get(name);
|
||||
|
||||
if(!value){
|
||||
return undefined;
|
||||
}
|
||||
|
||||
//if not a model
|
||||
if (!value.get) {
|
||||
return value = new Backbone.Model(value);
|
||||
value = new Backbone.Model(value);
|
||||
}
|
||||
|
||||
return value;
|
||||
|
@ -1,5 +1,5 @@
|
||||
"use strict";
|
||||
define(['app','Series/SeriesModel'], function () {
|
||||
define(['app', 'Series/SeriesModel'], function () {
|
||||
NzbDrone.Series.EpisodeModel = Backbone.Model.extend({
|
||||
|
||||
mutators: {
|
||||
@ -62,6 +62,13 @@ define(['app','Series/SeriesModel'], function () {
|
||||
return model;
|
||||
},
|
||||
|
||||
toJSON: function () {
|
||||
var json = _.clone(this.attributes);
|
||||
json.series = this.get('series').toJSON();
|
||||
|
||||
return json;
|
||||
},
|
||||
|
||||
defaults: {
|
||||
seasonNumber: 0,
|
||||
status : 0
|
||||
|
Loading…
Reference in New Issue
Block a user