mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-14 10:47:08 -07:00
removed NzbDrone. namespace, everything is done using require.
This commit is contained in:
parent
ef62af75df
commit
b0bd3f34f1
121 changed files with 2570 additions and 2587 deletions
|
@ -2,10 +2,10 @@
|
|||
define(
|
||||
[
|
||||
'app',
|
||||
'Series/SeriesModel'
|
||||
], function () {
|
||||
'marionette'
|
||||
], function (App, Marionette) {
|
||||
|
||||
NzbDrone.Series.Delete.DeleteSeriesView = Backbone.Marionette.ItemView.extend({
|
||||
return Marionette.ItemView.extend({
|
||||
template: 'Series/Delete/DeleteSeriesTemplate',
|
||||
|
||||
events: {
|
||||
|
@ -24,11 +24,8 @@ define(
|
|||
data: { 'deleteFiles': deleteFiles },
|
||||
wait: true
|
||||
}).done(function () {
|
||||
NzbDrone.modalRegion.close();
|
||||
App.modalRegion.close();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
return NzbDrone.Series.Delete.DeleteSeriesView;
|
||||
|
||||
});
|
||||
|
|
|
@ -1,28 +1,28 @@
|
|||
'use strict';
|
||||
define(['app',
|
||||
'Series/Details/SeasonLayout',
|
||||
'Series/SeasonCollection',
|
||||
'Series/EpisodeCollection'],
|
||||
function (App, SeasonLayout, SeasonCollection, EpisodeCollection) {
|
||||
NzbDrone.Series.Details.SeasonCollectionView = Backbone.Marionette.CollectionView.extend({
|
||||
define(
|
||||
[
|
||||
'marionette',
|
||||
'Series/Details/SeasonLayout'
|
||||
], function (Marionette, SeasonLayout) {
|
||||
return Marionette.CollectionView.extend({
|
||||
|
||||
itemView : SeasonLayout,
|
||||
itemView: SeasonLayout,
|
||||
|
||||
initialize: function (options) {
|
||||
initialize: function (options) {
|
||||
|
||||
if (!options.episodeCollection) {
|
||||
throw 'episodeCollection is needed';
|
||||
if (!options.episodeCollection) {
|
||||
throw 'episodeCollection is needed';
|
||||
}
|
||||
|
||||
this.episodeCollection = options.episodeCollection;
|
||||
|
||||
},
|
||||
|
||||
itemViewOptions: function () {
|
||||
return {
|
||||
episodeCollection: this.episodeCollection
|
||||
};
|
||||
}
|
||||
|
||||
this.episodeCollection = options.episodeCollection;
|
||||
|
||||
},
|
||||
|
||||
itemViewOptions: function () {
|
||||
return {
|
||||
episodeCollection: this.episodeCollection
|
||||
};
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,13 +1,17 @@
|
|||
'use strict';
|
||||
define([
|
||||
'app',
|
||||
'Cells/EpisodeStatusCell',
|
||||
'Cells/EpisodeTitleCell',
|
||||
'Cells/AirDateCell',
|
||||
'Cells/ToggleCell',
|
||||
'Shared/Messenger'],
|
||||
function (App, EpisodeStatusCell, EpisodeTitleCell, AirDateCell, ToggleCell, Messenger) {
|
||||
return Backbone.Marionette.Layout.extend({
|
||||
|
||||
'use strict';
|
||||
define(
|
||||
[
|
||||
'marionette',
|
||||
'backgrid',
|
||||
'Cells/ToggleCell',
|
||||
'Cells/EpisodeTitleCell',
|
||||
'Cells/AirDateCell',
|
||||
'Cells/EpisodeStatusCell',
|
||||
'Commands/CommandController',
|
||||
'Shared/Messenger'
|
||||
], function ( Marionette, Backgrid, ToggleCell, EpisodeTitleCell, AirDateCell, EpisodeStatusCell, CommandController, Messenger) {
|
||||
return Marionette.Layout.extend({
|
||||
template: 'Series/Details/SeasonLayoutTemplate',
|
||||
|
||||
ui: {
|
||||
|
@ -22,39 +26,38 @@ define([
|
|||
episodeGrid: '#x-episode-grid'
|
||||
},
|
||||
|
||||
columns: [
|
||||
|
||||
{
|
||||
name : 'ignored',
|
||||
label : '',
|
||||
cell : ToggleCell,
|
||||
trueClass : 'icon-bookmark-empty',
|
||||
falseClass: 'icon-bookmark'
|
||||
},
|
||||
{
|
||||
name : 'episodeNumber',
|
||||
label: '#',
|
||||
cell : Backgrid.IntegerCell.extend({
|
||||
className: 'episode-number-cell'
|
||||
})
|
||||
},
|
||||
|
||||
{
|
||||
name : 'this',
|
||||
label: 'Title',
|
||||
cell : EpisodeTitleCell
|
||||
},
|
||||
{
|
||||
name : 'airDate',
|
||||
label: 'Air Date',
|
||||
cell : AirDateCell
|
||||
} ,
|
||||
{
|
||||
name : 'status',
|
||||
label: 'Status',
|
||||
cell : EpisodeStatusCell
|
||||
}
|
||||
],
|
||||
columns:
|
||||
[
|
||||
{
|
||||
name : 'ignored',
|
||||
label : '',
|
||||
cell : ToggleCell,
|
||||
trueClass : 'icon-bookmark-empty',
|
||||
falseClass: 'icon-bookmark'
|
||||
},
|
||||
{
|
||||
name : 'episodeNumber',
|
||||
label: '#',
|
||||
cell : Backgrid.IntegerCell.extend({
|
||||
className: 'episode-number-cell'
|
||||
})
|
||||
},
|
||||
{
|
||||
name : 'this',
|
||||
label: 'Title',
|
||||
cell : EpisodeTitleCell
|
||||
},
|
||||
{
|
||||
name : 'airDate',
|
||||
label: 'Air Date',
|
||||
cell : AirDateCell
|
||||
} ,
|
||||
{
|
||||
name : 'status',
|
||||
label: 'Status',
|
||||
cell : EpisodeStatusCell
|
||||
}
|
||||
],
|
||||
|
||||
initialize: function (options) {
|
||||
|
||||
|
@ -66,12 +69,11 @@ define([
|
|||
},
|
||||
|
||||
onShow: function () {
|
||||
this.episodeGrid.show(new Backgrid.Grid(
|
||||
{
|
||||
columns : this.columns,
|
||||
collection: this.episodeCollection,
|
||||
className : 'table table-hover season-grid'
|
||||
}));
|
||||
this.episodeGrid.show(new Backgrid.Grid({
|
||||
columns : this.columns,
|
||||
collection: this.episodeCollection,
|
||||
className : 'table table-hover season-grid'
|
||||
}));
|
||||
},
|
||||
|
||||
_seasonSearch: function () {
|
||||
|
@ -82,12 +84,12 @@ define([
|
|||
this.ui.seasonSearch.addClass('icon-spinner icon-spin');
|
||||
|
||||
var properties = {
|
||||
seriesId: this.model.get('seriesId'),
|
||||
seriesId : this.model.get('seriesId'),
|
||||
seasonNumber: this.model.get('seasonNumber')
|
||||
};
|
||||
|
||||
var self = this;
|
||||
var commandPromise = App.Commands.Execute(command, properties);
|
||||
var commandPromise = CommandController.Execute(command, properties);
|
||||
|
||||
commandPromise.fail(function (options) {
|
||||
if (options.readyState === 0 || options.status === 0) {
|
||||
|
|
|
@ -1,6 +1,14 @@
|
|||
'use strict';
|
||||
define(['app', 'Series/Details/SeasonCollectionView', 'Shared/LoadingView','backstrech'], function () {
|
||||
NzbDrone.Series.Details.SeriesDetailsLayout = Backbone.Marionette.Layout.extend({
|
||||
define(
|
||||
[
|
||||
'marionette',
|
||||
'Series/EpisodeCollection',
|
||||
'Series/SeasonCollection',
|
||||
'Series/Details/SeasonCollectionView',
|
||||
'Shared/LoadingView',
|
||||
'backstrech'
|
||||
], function (Marionette, EpisodeCollection, SeasonCollection, SeasonCollectionView, LoadingView) {
|
||||
return Marionette.Layout.extend({
|
||||
|
||||
itemViewContainer: '.x-series-seasons',
|
||||
template : 'Series/Details/SeriesDetailsTemplate',
|
||||
|
@ -27,19 +35,17 @@ define(['app', 'Series/Details/SeasonCollectionView', 'Shared/LoadingView','back
|
|||
$('body').removeClass('backdrop');
|
||||
}
|
||||
|
||||
this.seasons.show(new NzbDrone.Shared.LoadingView());
|
||||
this.seasons.show(new LoadingView());
|
||||
|
||||
this.seasonCollection = new NzbDrone.Series.SeasonCollection();
|
||||
this.episodeCollection = new NzbDrone.Series.EpisodeCollection();
|
||||
this.seasonCollection = new SeasonCollection();
|
||||
this.episodeCollection = new EpisodeCollection();
|
||||
|
||||
$.when(this.episodeCollection.fetch({data: { seriesId: this.model.id }}), this.seasonCollection.fetch({data: { seriesId: this.model.id }}))
|
||||
.done(function () {
|
||||
self.seasons.show(new NzbDrone.Series.Details.SeasonCollectionView({
|
||||
collection : self.seasonCollection,
|
||||
episodeCollection: self.episodeCollection
|
||||
}));
|
||||
}
|
||||
);
|
||||
$.when(this.episodeCollection.fetch({data: { seriesId: this.model.id }}), this.seasonCollection.fetch({data: { seriesId: this.model.id }})).done(function () {
|
||||
self.seasons.show(new SeasonCollectionView({
|
||||
collection : self.seasonCollection,
|
||||
episodeCollection: self.episodeCollection
|
||||
}));
|
||||
});
|
||||
},
|
||||
|
||||
onClose: function () {
|
||||
|
@ -47,5 +53,4 @@ define(['app', 'Series/Details/SeasonCollectionView', 'Shared/LoadingView','back
|
|||
$('body').removeClass('backdrop');
|
||||
}
|
||||
});
|
||||
}
|
||||
);
|
||||
});
|
||||
|
|
|
@ -1,45 +1,50 @@
|
|||
'use strict';
|
||||
define(['app', 'Series/SeriesModel', 'Series/Delete/DeleteSeriesView', 'Quality/QualityProfileCollection'], function (app, seriesModel, deleteSeriesView, qualityProfiles) {
|
||||
'use strict';
|
||||
define(
|
||||
[
|
||||
'App',
|
||||
'marionette',
|
||||
'Series/Delete/DeleteSeriesView',
|
||||
'Quality/QualityProfileCollection',
|
||||
'Mixins/AsModelBoundView'
|
||||
], function (App, Marionette, DeleteSeriesView, QualityProfiles, AsModelBoundView) {
|
||||
|
||||
NzbDrone.Series.Edit.EditSeriesView = Backbone.Marionette.ItemView.extend({
|
||||
template : 'Series/Edit/EditSeriesTemplate',
|
||||
var view = Marionette.ItemView.extend({
|
||||
template: 'Series/Edit/EditSeriesTemplate',
|
||||
|
||||
ui: {
|
||||
progressbar : '.progress .bar',
|
||||
qualityProfile : '.x-quality-profile',
|
||||
backlogSettings: '.x-backlog-setting'
|
||||
},
|
||||
ui: {
|
||||
progressbar : '.progress .bar',
|
||||
qualityProfile : '.x-quality-profile',
|
||||
backlogSettings: '.x-backlog-setting'
|
||||
},
|
||||
|
||||
events: {
|
||||
'click .x-save' : 'saveSeries',
|
||||
'click .x-remove': 'removeSeries'
|
||||
},
|
||||
events: {
|
||||
'click .x-save' : 'saveSeries',
|
||||
'click .x-remove': 'removeSeries'
|
||||
},
|
||||
|
||||
|
||||
initialize : function(){
|
||||
|
||||
this.model.set('qualityProfiles',qualityProfiles);
|
||||
|
||||
},
|
||||
initialize: function () {
|
||||
this.model.set('qualityProfiles', QualityProfiles);
|
||||
},
|
||||
|
||||
|
||||
saveSeries: function () {
|
||||
//Todo: Get qualityProfile + backlog setting from UI
|
||||
var qualityProfile = this.ui.qualityProfile.val();
|
||||
var qualityProfileText = this.ui.qualityProfile.children('option:selected').text();
|
||||
var backlogSetting = this.ui.backlogSettings.val();
|
||||
saveSeries: function () {
|
||||
//Todo: Get qualityProfile + backlog setting from UI
|
||||
var qualityProfile = this.ui.qualityProfile.val();
|
||||
var qualityProfileText = this.ui.qualityProfile.children('option:selected').text();
|
||||
var backlogSetting = this.ui.backlogSettings.val();
|
||||
|
||||
this.model.set({ qualityProfileId: qualityProfile, backlogSetting: backlogSetting, qualityProfileName: qualityProfileText });
|
||||
this.model.set({ qualityProfileId: qualityProfile, backlogSetting: backlogSetting, qualityProfileName: qualityProfileText });
|
||||
|
||||
this.model.save();
|
||||
this.trigger('saved');
|
||||
NzbDrone.modalRegion.closeModal();
|
||||
},
|
||||
this.model.save();
|
||||
this.trigger('saved');
|
||||
App.modalRegion.closeModal();
|
||||
},
|
||||
|
||||
removeSeries: function () {
|
||||
var view = new NzbDrone.Series.Delete.DeleteSeriesView({ model: this.model });
|
||||
NzbDrone.modalRegion.show(view);
|
||||
}
|
||||
removeSeries: function () {
|
||||
var view = new DeleteSeriesView({ model: this.model });
|
||||
App.modalRegion.show(view);
|
||||
}
|
||||
});
|
||||
return AsModelBoundView.apply(view);
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
@ -1,18 +1,21 @@
|
|||
'use strict';
|
||||
define(['app', 'Series/EpisodeModel'], function () {
|
||||
NzbDrone.Series.EpisodeCollection = Backbone.Collection.extend({
|
||||
url : NzbDrone.Constants.ApiRoot + '/episodes',
|
||||
model: NzbDrone.Series.EpisodeModel,
|
||||
'use strict';
|
||||
define(
|
||||
[
|
||||
'backbone',
|
||||
'Series/EpisodeModel'
|
||||
], function (Backbone, EpisodeModel) {
|
||||
return Backbone.Collection.extend({
|
||||
url : window.ApiRoot + '/episodes',
|
||||
model: EpisodeModel,
|
||||
|
||||
bySeason: function (season) {
|
||||
var filtered = this.filter(function (episode) {
|
||||
return episode.get('seasonNumber') === season;
|
||||
});
|
||||
bySeason: function (season) {
|
||||
var filtered = this.filter(function (episode) {
|
||||
return episode.get('seasonNumber') === season;
|
||||
});
|
||||
|
||||
return new NzbDrone.Series.EpisodeCollection(filtered);
|
||||
}
|
||||
var EpisodeCollection = require('Series/EpisodeCollection');
|
||||
|
||||
return new EpisodeCollection(filtered);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
return NzbDrone.Series.EpisodeCollection;
|
||||
});
|
||||
|
|
|
@ -1,92 +1,95 @@
|
|||
'use strict';
|
||||
define(['app', 'Series/SeriesModel'], function () {
|
||||
NzbDrone.Series.EpisodeModel = Backbone.Model.extend({
|
||||
define(
|
||||
[
|
||||
'backbone',
|
||||
'Series/SeriesModel'
|
||||
], function (Backbone, SeriesModel) {
|
||||
return Backbone.Model.extend({
|
||||
|
||||
mutators: {
|
||||
paddedEpisodeNumber: function () {
|
||||
var test = this.get('episodeNumber');
|
||||
return this.get('episodeNumber').pad(2);
|
||||
},
|
||||
day : function () {
|
||||
return Date.create(this.get('airDate')).format('{dd}');
|
||||
},
|
||||
month : function () {
|
||||
return Date.create(this.get('airDate')).format('{MON}');
|
||||
},
|
||||
startTime : function () {
|
||||
var start = Date.create(this.get('airDate'));
|
||||
mutators: {
|
||||
paddedEpisodeNumber: function () {
|
||||
return this.get('episodeNumber').pad(2);
|
||||
},
|
||||
day : function () {
|
||||
return Date.create(this.get('airDate')).format('{dd}');
|
||||
},
|
||||
month : function () {
|
||||
return Date.create(this.get('airDate')).format('{MON}');
|
||||
},
|
||||
startTime : function () {
|
||||
var start = Date.create(this.get('airDate'));
|
||||
|
||||
if (start.format('{mm}') === '00') {
|
||||
return start.format('{h}{tt}');
|
||||
if (start.format('{mm}') === '00') {
|
||||
return start.format('{h}{tt}');
|
||||
}
|
||||
|
||||
return start.format('{h}.{mm}{tt}');
|
||||
},
|
||||
end : function () {
|
||||
|
||||
if (this.has('series')) {
|
||||
var start = Date.create(this.get('airDate'));
|
||||
var runtime = this.get('series').runtime;
|
||||
|
||||
return start.addMinutes(runtime);
|
||||
}
|
||||
|
||||
return undefined;
|
||||
},
|
||||
statusLevel : function () {
|
||||
var episodeFileId = this.get('episodeFileId');
|
||||
var currentTime = Date.create();
|
||||
var start = Date.create(this.get('airDate'));
|
||||
var end = Date.create(this.get('end'));
|
||||
|
||||
if (currentTime.isBetween(start, end)) {
|
||||
return 'warning';
|
||||
}
|
||||
|
||||
if (start.isBefore(currentTime) && episodeFileId === 0) {
|
||||
return 'danger';
|
||||
}
|
||||
|
||||
if (status === 'Ready') {
|
||||
return 'success';
|
||||
}
|
||||
|
||||
return 'primary';
|
||||
},
|
||||
hasAired : function () {
|
||||
return Date.create(this.get('airDate')).isBefore(Date.create());
|
||||
}
|
||||
|
||||
return start.format('{h}.{mm}{tt}');
|
||||
},
|
||||
end : function () {
|
||||
|
||||
|
||||
parse: function (model) {
|
||||
model.series = new SeriesModel(model.series);
|
||||
|
||||
return model;
|
||||
},
|
||||
|
||||
toJSON: function () {
|
||||
var json = _.clone(this.attributes);
|
||||
|
||||
_.each(this.mutators, _.bind(function (mutator, name) {
|
||||
// check if we have some getter mutations
|
||||
if (_.isObject(this.mutators[name]) === true && _.isFunction(this.mutators[name].get)) {
|
||||
json[name] = _.bind(this.mutators[name].get, this)();
|
||||
}
|
||||
else {
|
||||
json[name] = _.bind(this.mutators[name], this)();
|
||||
}
|
||||
}, this));
|
||||
|
||||
if (this.has('series')) {
|
||||
var start = Date.create(this.get('airDate'));
|
||||
var runtime = this.get('series').runtime;
|
||||
|
||||
return start.addMinutes(runtime);
|
||||
json.series = this.get('series').toJSON();
|
||||
}
|
||||
return json;
|
||||
},
|
||||
statusLevel : function () {
|
||||
var episodeFileId = this.get('episodeFileId');
|
||||
var currentTime = Date.create();
|
||||
var start = Date.create(this.get('airDate'));
|
||||
var end = Date.create(this.get('end'));
|
||||
|
||||
if (currentTime.isBetween(start, end)) {
|
||||
return 'warning';
|
||||
}
|
||||
|
||||
if (start.isBefore(currentTime) && episodeFileId === 0) {
|
||||
return 'danger';
|
||||
}
|
||||
|
||||
if (status === 'Ready') {
|
||||
return 'success';
|
||||
}
|
||||
|
||||
return 'primary';
|
||||
},
|
||||
hasAired : function () {
|
||||
return Date.create(this.get('airDate')).isBefore(Date.create());
|
||||
defaults: {
|
||||
seasonNumber: 0,
|
||||
status : 0
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
parse: function (model) {
|
||||
model.series = new NzbDrone.Series.SeriesModel(model.series);
|
||||
|
||||
return model;
|
||||
},
|
||||
|
||||
toJSON: function () {
|
||||
var json = _.clone(this.attributes);
|
||||
|
||||
_.each(this.mutators, _.bind(function (mutator, name) {
|
||||
// check if we have some getter mutations
|
||||
if (_.isObject(this.mutators[name]) === true && _.isFunction(this.mutators[name].get)) {
|
||||
json[name] = _.bind(this.mutators[name].get, this)();
|
||||
} else {
|
||||
json[name] = _.bind(this.mutators[name], this)();
|
||||
}
|
||||
}, this));
|
||||
|
||||
if (this.has('series'))
|
||||
{
|
||||
json.series = this.get('series').toJSON();
|
||||
}
|
||||
return json;
|
||||
},
|
||||
|
||||
defaults: {
|
||||
seasonNumber: 0,
|
||||
status : 0
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
return NzbDrone.Series.EpisodeModel;
|
||||
});
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
'use strict';
|
||||
define(['app'], function () {
|
||||
NzbDrone.Series.Index.EmptySeriesCollectionView = Backbone.Marionette.CompositeView.extend({
|
||||
template: 'Series/Index/EmptySeriesIndexTemplate'
|
||||
'use strict';
|
||||
define(
|
||||
[
|
||||
'marionette'
|
||||
], function (Marionette) {
|
||||
return Marionette.CompositeView.extend({
|
||||
template: 'Series/Index/EmptySeriesIndexTemplate'
|
||||
});
|
||||
});
|
||||
|
||||
return NzbDrone.Series.Index.EmptySeriesCollectionView;
|
||||
});
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
'use strict';
|
||||
'use strict';
|
||||
|
||||
define(['app'], function () {
|
||||
define(
|
||||
[
|
||||
'marionette'
|
||||
], function (Marionette) {
|
||||
|
||||
NzbDrone.Series.Index.EmptyView = Backbone.Marionette.CompositeView.extend({
|
||||
template: 'Series/Index/EmptyTemplate'
|
||||
return Marionette.CompositeView.extend({
|
||||
template: 'Series/Index/EmptyTemplate'
|
||||
});
|
||||
});
|
||||
|
||||
return NzbDrone.Series.Index.EmptyView;
|
||||
});
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
'use strict';
|
||||
'use strict';
|
||||
|
||||
define(['app', 'Series/Index/List/ItemView', 'Config'], function () {
|
||||
define(
|
||||
[
|
||||
'marionette',
|
||||
'Series/Index/List/ItemView'
|
||||
], function (Marionette, ListItemView) {
|
||||
|
||||
NzbDrone.Series.Index.List.CollectionView = Backbone.Marionette.CompositeView.extend({
|
||||
itemView : NzbDrone.Series.Index.List.ItemView,
|
||||
itemViewContainer : '#x-series-list',
|
||||
template : 'Series/Index/List/CollectionTemplate'
|
||||
return Marionette.CompositeView.extend({
|
||||
itemView : ListItemView,
|
||||
itemViewContainer: '#x-series-list',
|
||||
template : 'Series/Index/List/CollectionTemplate'
|
||||
});
|
||||
});
|
||||
|
||||
return NzbDrone.Series.Index.List.CollectionView;
|
||||
});
|
||||
|
|
|
@ -1,36 +1,33 @@
|
|||
'use strict';
|
||||
'use strict';
|
||||
|
||||
define([
|
||||
'app',
|
||||
'Quality/QualityProfileCollection',
|
||||
'Series/SeriesCollection',
|
||||
'Series/Edit/EditSeriesView',
|
||||
'Series/Delete/DeleteSeriesView',
|
||||
'Shared/FormatHelpers'
|
||||
define(
|
||||
[
|
||||
'app',
|
||||
'marionette',
|
||||
'Series/Edit/EditSeriesView',
|
||||
'Series/Delete/DeleteSeriesView'
|
||||
|
||||
], function () {
|
||||
NzbDrone.Series.Index.List.ItemView = Backbone.Marionette.ItemView.extend({
|
||||
template: 'Series/Index/List/ItemTemplate',
|
||||
], function (App, Marionette, EditSeriesView, DeleteSeriesView) {
|
||||
return Marionette.ItemView.extend({
|
||||
template: 'Series/Index/List/ItemTemplate',
|
||||
|
||||
ui: {
|
||||
'progressbar': '.progress .bar'
|
||||
},
|
||||
ui: {
|
||||
'progressbar': '.progress .bar'
|
||||
},
|
||||
|
||||
events: {
|
||||
'click .x-edit' : 'editSeries',
|
||||
'click .x-remove': 'removeSeries'
|
||||
},
|
||||
events: {
|
||||
'click .x-edit' : 'editSeries',
|
||||
'click .x-remove': 'removeSeries'
|
||||
},
|
||||
|
||||
editSeries: function () {
|
||||
var view = new NzbDrone.Series.Edit.EditSeriesView({ model: this.model});
|
||||
NzbDrone.modalRegion.show(view);
|
||||
},
|
||||
editSeries: function () {
|
||||
var view = new EditSeriesView({ model: this.model});
|
||||
App.modalRegion.show(view);
|
||||
},
|
||||
|
||||
removeSeries: function () {
|
||||
var view = new NzbDrone.Series.Delete.DeleteSeriesView({ model: this.model });
|
||||
NzbDrone.modalRegion.show(view);
|
||||
}
|
||||
removeSeries: function () {
|
||||
var view = new DeleteSeriesView({ model: this.model });
|
||||
App.modalRegion.show(view);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
return NzbDrone.Series.Index.List.ItemView;
|
||||
});
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
'use strict';
|
||||
'use strict';
|
||||
|
||||
define(['app', 'Series/Index/Posters/ItemView', 'Config'], function () {
|
||||
define(
|
||||
[
|
||||
'marionette',
|
||||
'Series/Index/Posters/ItemView'
|
||||
], function (Marionette, PosterItemView) {
|
||||
|
||||
NzbDrone.Series.Index.Posters.CollectionView = Backbone.Marionette.CompositeView.extend({
|
||||
itemView : NzbDrone.Series.Index.Posters.ItemView,
|
||||
itemViewContainer : '#x-series-posters',
|
||||
template : 'Series/Index/Posters/CollectionTemplate'
|
||||
return Marionette.CompositeView.extend({
|
||||
itemView : PosterItemView,
|
||||
itemViewContainer: '#x-series-posters',
|
||||
template : 'Series/Index/Posters/CollectionTemplate'
|
||||
});
|
||||
});
|
||||
|
||||
return NzbDrone.Series.Index.Posters.CollectionView;
|
||||
});
|
||||
|
|
|
@ -1,45 +1,44 @@
|
|||
'use strict';
|
||||
'use strict';
|
||||
|
||||
define([
|
||||
'app',
|
||||
'Series/SeriesCollection',
|
||||
'Series/Edit/EditSeriesView',
|
||||
'Series/Delete/DeleteSeriesView'
|
||||
define(
|
||||
[
|
||||
'app',
|
||||
'marionette',
|
||||
'Series/Edit/EditSeriesView',
|
||||
'Series/Delete/DeleteSeriesView'
|
||||
|
||||
], function () {
|
||||
], function (App, Marionette, EditSeriesView, DeleteSeriesView) {
|
||||
|
||||
NzbDrone.Series.Index.Posters.ItemView = Backbone.Marionette.ItemView.extend({
|
||||
tagName : 'li',
|
||||
template: 'Series/Index/Posters/ItemTemplate',
|
||||
return Marionette.ItemView.extend({
|
||||
tagName : 'li',
|
||||
template: 'Series/Index/Posters/ItemTemplate',
|
||||
|
||||
|
||||
ui: {
|
||||
'progressbar': '.progress .bar',
|
||||
'controls': '.series-controls'
|
||||
},
|
||||
ui: {
|
||||
'progressbar': '.progress .bar',
|
||||
'controls' : '.series-controls'
|
||||
},
|
||||
|
||||
events: {
|
||||
'click .x-edit' : 'editSeries',
|
||||
'click .x-remove': 'removeSeries',
|
||||
'mouseenter .x-series-poster': 'posterHoverAction',
|
||||
'mouseleave .x-series-poster': 'posterHoverAction'
|
||||
},
|
||||
events: {
|
||||
'click .x-edit' : 'editSeries',
|
||||
'click .x-remove' : 'removeSeries',
|
||||
'mouseenter .x-series-poster': 'posterHoverAction',
|
||||
'mouseleave .x-series-poster': 'posterHoverAction'
|
||||
},
|
||||
|
||||
|
||||
editSeries: function () {
|
||||
var view = new NzbDrone.Series.Edit.EditSeriesView({ model: this.model});
|
||||
NzbDrone.modalRegion.show(view);
|
||||
},
|
||||
editSeries: function () {
|
||||
var view = new EditSeriesView({ model: this.model});
|
||||
App.modalRegion.show(view);
|
||||
},
|
||||
|
||||
removeSeries: function () {
|
||||
var view = new NzbDrone.Series.Delete.DeleteSeriesView({ model: this.model });
|
||||
NzbDrone.modalRegion.show(view);
|
||||
},
|
||||
removeSeries: function () {
|
||||
var view = new DeleteSeriesView({ model: this.model });
|
||||
App.modalRegion.show(view);
|
||||
},
|
||||
|
||||
posterHoverAction: function () {
|
||||
this.ui.controls.slideToggle();
|
||||
}
|
||||
posterHoverAction: function () {
|
||||
this.ui.controls.slideToggle();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
return NzbDrone.Series.Index.Posters.ItemView;
|
||||
});
|
||||
|
|
|
@ -1,33 +1,22 @@
|
|||
'use strict';
|
||||
define([
|
||||
'app',
|
||||
'Series/Index/List/CollectionView',
|
||||
'Series/Index/Posters/CollectionView',
|
||||
'Series/Index/EmptyView',
|
||||
'Series/SeriesCollection',
|
||||
'Cells/AirDateCell',
|
||||
'Cells/SeriesTitleCell',
|
||||
'Cells/SeriesStatusCell',
|
||||
'Cells/TemplatedCell',
|
||||
'Shared/Toolbar/ToolbarLayout',
|
||||
'Config',
|
||||
'Shared/LoadingView'
|
||||
],
|
||||
function (
|
||||
App,
|
||||
ListCollectionView,
|
||||
PosterCollectionView,
|
||||
EmptyView,
|
||||
SeriesCollection,
|
||||
AirDateCell,
|
||||
SeriesTitleCell,
|
||||
SeriesStatusCell,
|
||||
TemplatedCell,
|
||||
ToolbarLayout,
|
||||
Config,
|
||||
LoadingView)
|
||||
{
|
||||
NzbDrone.Series.Index.SeriesIndexLayout = Backbone.Marionette.Layout.extend({
|
||||
define(
|
||||
[
|
||||
'marionette',
|
||||
'Series/Index/Posters/CollectionView',
|
||||
'Series/Index/List/CollectionView',
|
||||
'Series/Index/EmptyView',
|
||||
'Series/SeriesCollection',
|
||||
'Cells/AirDateCell',
|
||||
'Cells/SeriesTitleCell',
|
||||
'Cells/TemplatedCell',
|
||||
'Series/Index/Table/SeriesStatusCell',
|
||||
'Series/Index/Table/Row',
|
||||
'Shared/Toolbar/ToolbarLayout',
|
||||
'Config',
|
||||
'Shared/LoadingView'
|
||||
], function (Marionette, PosterCollectionView, ListCollectionView, EmptyView, SeriesCollection, AirDateCell, SeriesTitleCell, TemplatedCell, SeriesStatusCell, SeriesIndexRow,
|
||||
ToolbarLayout, Config, LoadingView) {
|
||||
return Marionette.Layout.extend({
|
||||
template: 'Series/Index/SeriesIndexLayoutTemplate',
|
||||
|
||||
regions: {
|
||||
|
@ -35,87 +24,88 @@ define([
|
|||
toolbar: '#x-toolbar'
|
||||
},
|
||||
|
||||
columns: [
|
||||
{
|
||||
name : 'status',
|
||||
label: '',
|
||||
cell : SeriesStatusCell
|
||||
},
|
||||
{
|
||||
name : 'this',
|
||||
label: 'Title',
|
||||
cell : SeriesTitleCell
|
||||
},
|
||||
{
|
||||
name : 'seasonCount',
|
||||
label: 'Seasons',
|
||||
cell : 'integer'
|
||||
},
|
||||
{
|
||||
name : 'quality',
|
||||
label: 'Quality',
|
||||
cell : 'integer'
|
||||
},
|
||||
{
|
||||
name : 'network',
|
||||
label: 'Network',
|
||||
cell : 'string'
|
||||
},
|
||||
{
|
||||
name : 'nextAiring',
|
||||
label: 'Next Airing',
|
||||
cell : AirDateCell
|
||||
},
|
||||
{
|
||||
name : 'this',
|
||||
label : 'Episodes',
|
||||
sortable: false,
|
||||
template: 'Series/EpisodeProgressTemplate',
|
||||
cell : TemplatedCell
|
||||
},
|
||||
{
|
||||
name : 'this',
|
||||
label : '',
|
||||
sortable: false,
|
||||
template: 'Series/Index/Table/ControlsColumnTemplate',
|
||||
cell : TemplatedCell
|
||||
}
|
||||
],
|
||||
columns:
|
||||
[
|
||||
{
|
||||
name : 'status',
|
||||
label: '',
|
||||
cell : SeriesStatusCell
|
||||
},
|
||||
{
|
||||
name : 'this',
|
||||
label: 'Title',
|
||||
cell : SeriesTitleCell
|
||||
},
|
||||
{
|
||||
name : 'seasonCount',
|
||||
label: 'Seasons',
|
||||
cell : 'integer'
|
||||
},
|
||||
{
|
||||
name : 'quality',
|
||||
label: 'Quality',
|
||||
cell : 'integer'
|
||||
},
|
||||
{
|
||||
name : 'network',
|
||||
label: 'Network',
|
||||
cell : 'string'
|
||||
},
|
||||
{
|
||||
name : 'nextAiring',
|
||||
label: 'Next Airing',
|
||||
cell : AirDateCell
|
||||
},
|
||||
{
|
||||
name : 'this',
|
||||
label : 'Episodes',
|
||||
sortable: false,
|
||||
template: 'Series/EpisodeProgressTemplate',
|
||||
cell : TemplatedCell
|
||||
},
|
||||
{
|
||||
name : 'this',
|
||||
label : '',
|
||||
sortable: false,
|
||||
template: 'Series/Index/Table/ControlsColumnTemplate',
|
||||
cell : TemplatedCell
|
||||
}
|
||||
],
|
||||
|
||||
leftSideButtons: {
|
||||
type : 'default',
|
||||
storeState: false,
|
||||
items : [
|
||||
{
|
||||
title: 'Add Series',
|
||||
icon : 'icon-plus',
|
||||
route: 'series/add'
|
||||
},
|
||||
{
|
||||
title : 'RSS Sync',
|
||||
icon : 'icon-rss',
|
||||
command : 'rsssync',
|
||||
successMessage: 'RSS Sync Completed',
|
||||
errorMessage : 'RSS Sync Failed!'
|
||||
},
|
||||
{
|
||||
title : 'Update Library',
|
||||
icon : 'icon-refresh',
|
||||
command : 'refreshseries',
|
||||
successMessage: 'Library was updated!',
|
||||
errorMessage : 'Library update failed!'
|
||||
}
|
||||
]
|
||||
items :
|
||||
[
|
||||
{
|
||||
title: 'Add Series',
|
||||
icon : 'icon-plus',
|
||||
route: 'series/add'
|
||||
},
|
||||
{
|
||||
title : 'RSS Sync',
|
||||
icon : 'icon-rss',
|
||||
command : 'rsssync',
|
||||
successMessage: 'RSS Sync Completed',
|
||||
errorMessage : 'RSS Sync Failed!'
|
||||
},
|
||||
{
|
||||
title : 'Update Library',
|
||||
icon : 'icon-refresh',
|
||||
command : 'refreshseries',
|
||||
successMessage: 'Library was updated!',
|
||||
errorMessage : 'Library update failed!'
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
_showTable: function () {
|
||||
var view = new Backgrid.Grid(
|
||||
{
|
||||
row : NzbDrone.Series.Index.Table.Row,
|
||||
columns : this.columns,
|
||||
collection: this.seriesCollection,
|
||||
className : 'table table-hover'
|
||||
});
|
||||
var view = new Backgrid.Grid({
|
||||
row : SeriesIndexRow,
|
||||
columns : this.columns,
|
||||
collection: this.seriesCollection,
|
||||
className : 'table table-hover'
|
||||
});
|
||||
|
||||
this._fetchCollection(view);
|
||||
},
|
||||
|
@ -140,16 +130,15 @@ define([
|
|||
if (this.seriesCollection.models.length === 0) {
|
||||
this.series.show(new LoadingView());
|
||||
|
||||
this.seriesCollection.fetch()
|
||||
.done(function () {
|
||||
if (self.seriesCollection.models.length === 0) {
|
||||
self._showEmpty();
|
||||
}
|
||||
else {
|
||||
view.collection = self.seriesCollection;
|
||||
self.series.show(view);
|
||||
}
|
||||
});
|
||||
this.seriesCollection.fetch().done(function () {
|
||||
if (self.seriesCollection.models.length === 0) {
|
||||
self._showEmpty();
|
||||
}
|
||||
else {
|
||||
view.collection = self.seriesCollection;
|
||||
self.series.show(view);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
else {
|
||||
|
@ -170,35 +159,40 @@ define([
|
|||
storeState : true,
|
||||
menuKey : 'seriesViewMode',
|
||||
defaultAction: 'listView',
|
||||
items : [
|
||||
{
|
||||
key : 'tableView',
|
||||
title : '',
|
||||
icon : 'icon-table',
|
||||
callback: this._showTable
|
||||
},
|
||||
{
|
||||
key : 'listView',
|
||||
title : '',
|
||||
icon : 'icon-list',
|
||||
callback: this._showList
|
||||
},
|
||||
{
|
||||
key : 'posterView',
|
||||
title : '',
|
||||
icon : 'icon-picture',
|
||||
callback: this._showPosters
|
||||
}
|
||||
]
|
||||
items :
|
||||
[
|
||||
{
|
||||
key : 'tableView',
|
||||
title : '',
|
||||
icon : 'icon-table',
|
||||
callback: this._showTable
|
||||
},
|
||||
{
|
||||
key : 'listView',
|
||||
title : '',
|
||||
icon : 'icon-list',
|
||||
callback: this._showList
|
||||
},
|
||||
{
|
||||
key : 'posterView',
|
||||
title : '',
|
||||
icon : 'icon-picture',
|
||||
callback: this._showPosters
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
this.toolbar.show(new ToolbarLayout({
|
||||
right : [ viewButtons],
|
||||
left : [ this.leftSideButtons],
|
||||
right :
|
||||
[
|
||||
viewButtons
|
||||
],
|
||||
left :
|
||||
[
|
||||
this.leftSideButtons
|
||||
],
|
||||
context: this
|
||||
}));
|
||||
}
|
||||
});
|
||||
|
||||
return NzbDrone.Series.Index.SeriesIndexLayou;
|
||||
});
|
||||
|
|
|
@ -1,22 +1,26 @@
|
|||
'use strict';
|
||||
define(['app','backgrid'], function () {
|
||||
NzbDrone.Series.Index.Table.Row = Backgrid.Row.extend({
|
||||
events: {
|
||||
'click .x-edit' : 'editSeries',
|
||||
'click .x-remove': 'removeSeries'
|
||||
},
|
||||
define(
|
||||
[
|
||||
'app',
|
||||
'backgrid',
|
||||
'Series/Edit/EditSeriesView',
|
||||
'Series/Delete/DeleteSeriesView'
|
||||
], function (App, Backgrid, EditSeriesView, DeleteSeriesView) {
|
||||
return Backgrid.Row.extend({
|
||||
events: {
|
||||
'click .x-edit' : 'editSeries',
|
||||
'click .x-remove': 'removeSeries'
|
||||
},
|
||||
|
||||
editSeries: function () {
|
||||
var view = new NzbDrone.Series.Edit.EditSeriesView({ model: this.model});
|
||||
NzbDrone.modalRegion.show(view);
|
||||
},
|
||||
editSeries: function () {
|
||||
var view = new EditSeriesView({ model: this.model});
|
||||
App.modalRegion.show(view);
|
||||
},
|
||||
|
||||
removeSeries: function () {
|
||||
var view = new NzbDrone.Series.Delete.DeleteSeriesView({ model: this.model });
|
||||
NzbDrone.modalRegion.show(view);
|
||||
}
|
||||
removeSeries: function () {
|
||||
var view = new DeleteSeriesView({ model: this.model });
|
||||
App.modalRegion.show(view);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
return NzbDrone.Series.Table.Row;
|
||||
});
|
||||
|
||||
|
|
28
UI/Series/Index/Table/SeriesStatusCell.js
Normal file
28
UI/Series/Index/Table/SeriesStatusCell.js
Normal file
|
@ -0,0 +1,28 @@
|
|||
'use strict';
|
||||
define(
|
||||
[
|
||||
'backgrid'
|
||||
], function (Backgrid) {
|
||||
return Backgrid.Cell.extend({
|
||||
className: 'series-status-cell',
|
||||
|
||||
render: function () {
|
||||
this.$el.empty();
|
||||
var monitored = this.model.get('monitored');
|
||||
var status = this.model.get('status');
|
||||
|
||||
if (!monitored) {
|
||||
this.$el.html('<i class="icon-pause grid-icon" title="Not Monitored"></i>');
|
||||
}
|
||||
else if (status === 'continuing') {
|
||||
this.$el.html('<i class="icon-play grid-icon" title="Continuing"></i>');
|
||||
}
|
||||
|
||||
else {
|
||||
this.$el.html('<i class="icon-stop grid-icon" title="Ended"></i>');
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
});
|
||||
});
|
|
@ -1,23 +1,24 @@
|
|||
'use strict';
|
||||
define(['app', 'Series/SeasonModel', 'backbone.pageable'], function (App, SeasonModel, PageAbleCollection) {
|
||||
NzbDrone.Series.SeasonCollection = PageAbleCollection.extend({
|
||||
url : NzbDrone.Constants.ApiRoot + '/season',
|
||||
model: NzbDrone.Series.SeasonModel,
|
||||
'use strict';
|
||||
define(
|
||||
[
|
||||
'Series/SeasonModel',
|
||||
'backbone.pageable'
|
||||
], function (SeasonModel, PageAbleCollection) {
|
||||
return PageAbleCollection.extend({
|
||||
url : window.ApiRoot + '/season',
|
||||
model: SeasonModel,
|
||||
|
||||
mode: 'client',
|
||||
mode: 'client',
|
||||
|
||||
state: {
|
||||
sortKey : 'seasonNumber',
|
||||
order : 1,
|
||||
pageSize: 1000000
|
||||
},
|
||||
state: {
|
||||
sortKey : 'seasonNumber',
|
||||
order : 1,
|
||||
pageSize: 1000000
|
||||
},
|
||||
|
||||
queryParams: {
|
||||
sortKey: null,
|
||||
order : null
|
||||
}
|
||||
queryParams: {
|
||||
sortKey: null,
|
||||
order : null
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
return NzbDrone.Series.SeasonCollection;
|
||||
});
|
||||
|
|
|
@ -1,24 +1,25 @@
|
|||
'use strict';
|
||||
define(['app'], function () {
|
||||
NzbDrone.Series.SeasonModel = Backbone.Model.extend({
|
||||
'use strict';
|
||||
define(
|
||||
[
|
||||
'backbone'
|
||||
], function (Backbone) {
|
||||
return Backbone.Model.extend({
|
||||
|
||||
mutators: {
|
||||
seasonTitle: function () {
|
||||
var seasonNumber = this.get('seasonNumber');
|
||||
mutators: {
|
||||
seasonTitle: function () {
|
||||
var seasonNumber = this.get('seasonNumber');
|
||||
|
||||
if (seasonNumber === 0) {
|
||||
return 'Specials';
|
||||
if (seasonNumber === 0) {
|
||||
return 'Specials';
|
||||
}
|
||||
|
||||
return 'Season ' + seasonNumber;
|
||||
}
|
||||
},
|
||||
|
||||
return 'Season ' + seasonNumber;
|
||||
defaults: {
|
||||
seasonNumber: 0
|
||||
}
|
||||
},
|
||||
|
||||
defaults: {
|
||||
seasonNumber: 0
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
return NzbDrone.Series.SeasonModel;
|
||||
});
|
||||
|
||||
|
|
|
@ -1,18 +1,20 @@
|
|||
'use strict';
|
||||
define(['app', 'Series/SeriesModel'], function () {
|
||||
NzbDrone.Series.SeriesCollection = Backbone.Collection.extend({
|
||||
url : NzbDrone.Constants.ApiRoot + '/series',
|
||||
model: NzbDrone.Series.SeriesModel,
|
||||
'use strict';
|
||||
define(
|
||||
[
|
||||
'backbone',
|
||||
'Series/SeriesModel'
|
||||
], function (Backbone, SeriesModel) {
|
||||
return Backbone.Collection.extend({
|
||||
url : window.ApiRoot + '/series',
|
||||
model: SeriesModel,
|
||||
|
||||
comparator: function(model) {
|
||||
return model.get('title');
|
||||
},
|
||||
comparator: function (model) {
|
||||
return model.get('title');
|
||||
},
|
||||
|
||||
state: {
|
||||
sortKey: 'title',
|
||||
order: -1
|
||||
}
|
||||
state: {
|
||||
sortKey: 'title',
|
||||
order : -1
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
return NzbDrone.Series.SeriesCollection;
|
||||
});
|
||||
|
|
|
@ -1,87 +1,88 @@
|
|||
'use strict';
|
||||
define(['app', 'Quality/QualityProfileCollection'], function (app, qualityProfiles) {
|
||||
NzbDrone.Series.SeriesModel = Backbone.Model.extend({
|
||||
'use strict';
|
||||
define(
|
||||
[
|
||||
'backbone',
|
||||
'Quality/QualityProfileCollection',
|
||||
], function (Backbone, QualityProfileCollection) {
|
||||
return Backbone.Model.extend({
|
||||
|
||||
urlRoot: NzbDrone.Constants.ApiRoot + '/series',
|
||||
urlRoot: Constants.ApiRoot + '/series',
|
||||
|
||||
mutators: {
|
||||
percentOfEpisodes: function () {
|
||||
var episodeCount = this.get('episodeCount');
|
||||
var episodeFileCount = this.get('episodeFileCount');
|
||||
mutators: {
|
||||
percentOfEpisodes: function () {
|
||||
var episodeCount = this.get('episodeCount');
|
||||
var episodeFileCount = this.get('episodeFileCount');
|
||||
|
||||
var percent = 100;
|
||||
var percent = 100;
|
||||
|
||||
if (episodeCount > 0) {
|
||||
percent = episodeFileCount / episodeCount * 100;
|
||||
if (episodeCount > 0) {
|
||||
percent = episodeFileCount / episodeCount * 100;
|
||||
}
|
||||
|
||||
return percent;
|
||||
},
|
||||
poster : function () {
|
||||
var poster = _.find(this.get('images'), function (image) {
|
||||
return image.coverType === 'poster';
|
||||
});
|
||||
|
||||
if (poster) {
|
||||
return poster.url;
|
||||
}
|
||||
|
||||
return undefined;
|
||||
},
|
||||
fanArt : function () {
|
||||
var poster = _.find(this.get('images'), function (image) {
|
||||
return image.coverType === 'fanart';
|
||||
});
|
||||
|
||||
if (poster) {
|
||||
return poster.url;
|
||||
}
|
||||
|
||||
return undefined;
|
||||
},
|
||||
traktUrl : function () {
|
||||
return 'http://trakt.tv/show/' + this.get('titleSlug');
|
||||
},
|
||||
imdbUrl : function () {
|
||||
return 'http://imdb.com/title/' + this.get('imdbId');
|
||||
},
|
||||
isContinuing : function () {
|
||||
return this.get('status') === 'continuing';
|
||||
},
|
||||
shortDate : function () {
|
||||
var date = this.get('nextAiring');
|
||||
|
||||
if (!date) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return Date.create(date).short();
|
||||
},
|
||||
route : function () {
|
||||
return '/series/details/' + this.get('titleSlug');
|
||||
//return '/series/details/' + this.get('id');
|
||||
},
|
||||
|
||||
qualityProfile: function () {
|
||||
|
||||
var profile = QualityProfileCollection.get(this.get('qualityProfileId'));
|
||||
|
||||
if (profile) {
|
||||
return profile.toJSON();
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return percent;
|
||||
},
|
||||
poster : function () {
|
||||
var poster = _.find(this.get('images'), function (image) {
|
||||
return image.coverType === 'poster';
|
||||
});
|
||||
|
||||
if (poster) {
|
||||
return poster.url;
|
||||
}
|
||||
|
||||
return undefined;
|
||||
},
|
||||
fanArt : function () {
|
||||
var poster = _.find(this.get('images'), function (image) {
|
||||
return image.coverType === 'fanart';
|
||||
});
|
||||
|
||||
if (poster) {
|
||||
return poster.url;
|
||||
}
|
||||
|
||||
return undefined;
|
||||
},
|
||||
traktUrl : function () {
|
||||
return 'http://trakt.tv/show/' + this.get('titleSlug');
|
||||
},
|
||||
imdbUrl : function () {
|
||||
return 'http://imdb.com/title/' + this.get('imdbId');
|
||||
},
|
||||
isContinuing : function () {
|
||||
return this.get('status') === 'continuing';
|
||||
},
|
||||
shortDate : function () {
|
||||
var date = this.get('nextAiring');
|
||||
|
||||
if (!date) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return Date.create(date).short();
|
||||
},
|
||||
route : function () {
|
||||
return '/series/details/' + this.get('titleSlug');
|
||||
//return '/series/details/' + this.get('id');
|
||||
},
|
||||
|
||||
qualityProfile: function () {
|
||||
|
||||
var profile = qualityProfiles.get(this.get('qualityProfileId'));
|
||||
|
||||
if (profile) {
|
||||
return profile.toJSON();
|
||||
}
|
||||
|
||||
return undefined;
|
||||
defaults: {
|
||||
episodeFileCount: 0,
|
||||
episodeCount : 0,
|
||||
isExisting : false,
|
||||
status : 0
|
||||
}
|
||||
},
|
||||
|
||||
defaults: {
|
||||
episodeFileCount: 0,
|
||||
episodeCount : 0,
|
||||
isExisting : false,
|
||||
status : 0
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
return NzbDrone.Series.SeriesModel;
|
||||
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue