2013-04-23 00:35:04 +00:00
|
|
|
"use strict";
|
|
|
|
define([
|
|
|
|
'app',
|
|
|
|
'Series/Index/List/CollectionView',
|
2013-04-24 03:11:45 +00:00
|
|
|
'Series/Index/Posters/CollectionView',
|
2013-04-24 00:30:25 +00:00
|
|
|
'Series/Index/EmptyView',
|
|
|
|
'Series/Index/Table/AirDateCell',
|
2013-04-25 04:27:49 +00:00
|
|
|
'Series/Index/Table/SeriesStatusCell',
|
2013-04-24 01:55:29 +00:00
|
|
|
'Shared/Toolbar/ToolbarView',
|
2013-04-24 05:56:51 +00:00
|
|
|
'Shared/Toolbar/ToolbarLayout',
|
2013-04-24 01:55:29 +00:00
|
|
|
'Config'
|
2013-04-23 00:35:04 +00:00
|
|
|
],
|
2013-04-23 02:07:21 +00:00
|
|
|
function () {
|
2013-04-23 00:35:04 +00:00
|
|
|
NzbDrone.Series.Index.SeriesIndexLayout = Backbone.Marionette.Layout.extend({
|
|
|
|
template: 'Series/Index/SeriesIndexLayoutTemplate',
|
|
|
|
|
|
|
|
regions: {
|
2013-04-24 01:55:29 +00:00
|
|
|
series : '#x-series',
|
|
|
|
toolbar: '#x-toolbar'
|
2013-04-23 00:35:04 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
showTable: function () {
|
|
|
|
|
2013-04-25 04:27:49 +00:00
|
|
|
var columns = [
|
2013-04-23 00:35:04 +00:00
|
|
|
{
|
2013-04-25 04:27:49 +00:00
|
|
|
name : 'status',
|
|
|
|
label : '',
|
|
|
|
editable : false,
|
|
|
|
cell : 'seriesStatus',
|
2013-04-23 07:11:52 +00:00
|
|
|
headerCell: 'nzbDrone'
|
2013-04-23 00:35:04 +00:00
|
|
|
},
|
|
|
|
{
|
2013-04-25 04:27:49 +00:00
|
|
|
name : 'title',
|
|
|
|
label : 'Title',
|
|
|
|
editable : false,
|
|
|
|
cell : Backgrid.TemplateBackedCell.extend({ template: 'Series/Index/Table/SeriesTitleTemplate' }),
|
2013-04-23 07:11:52 +00:00
|
|
|
headerCell: 'nzbDrone'
|
2013-04-23 00:35:04 +00:00
|
|
|
},
|
|
|
|
{
|
2013-04-25 04:27:49 +00:00
|
|
|
name : 'seasonCount',
|
|
|
|
label : 'Seasons',
|
|
|
|
editable : false,
|
|
|
|
cell : 'integer',
|
2013-04-23 07:11:52 +00:00
|
|
|
headerCell: 'nzbDrone'
|
2013-04-23 00:35:04 +00:00
|
|
|
},
|
|
|
|
{
|
2013-04-25 04:27:49 +00:00
|
|
|
name : 'quality',
|
|
|
|
label : 'Quality',
|
|
|
|
editable : false,
|
|
|
|
cell : 'integer',
|
2013-04-23 07:11:52 +00:00
|
|
|
headerCell: 'nzbDrone'
|
2013-04-23 00:35:04 +00:00
|
|
|
},
|
|
|
|
{
|
2013-04-25 04:27:49 +00:00
|
|
|
name : 'network',
|
|
|
|
label : 'Network',
|
|
|
|
editable : false,
|
|
|
|
cell : 'string',
|
2013-04-23 07:11:52 +00:00
|
|
|
headerCell: 'nzbDrone'
|
2013-04-23 00:35:04 +00:00
|
|
|
},
|
|
|
|
{
|
2013-04-25 04:27:49 +00:00
|
|
|
name : 'nextAiring',
|
|
|
|
label : 'Next Airing',
|
|
|
|
editable : false,
|
|
|
|
cell : 'airDate',
|
2013-04-23 07:11:52 +00:00
|
|
|
headerCell: 'nzbDrone'
|
2013-04-23 00:35:04 +00:00
|
|
|
},
|
|
|
|
{
|
2013-04-25 04:27:49 +00:00
|
|
|
name : 'episodes',
|
|
|
|
label : 'Episodes',
|
|
|
|
editable : false,
|
|
|
|
sortable : false,
|
|
|
|
cell : Backgrid.TemplateBackedCell.extend({ template: 'Series/EpisodeProgressTemplate' }),
|
2013-04-23 07:11:52 +00:00
|
|
|
headerCell: 'nzbDrone'
|
2013-04-23 00:35:04 +00:00
|
|
|
},
|
|
|
|
{
|
2013-04-25 04:27:49 +00:00
|
|
|
name : 'edit',
|
|
|
|
label : '',
|
|
|
|
editable : false,
|
|
|
|
sortable : false,
|
|
|
|
cell : Backgrid.TemplateBackedCell.extend({ template: 'Series/Index/Table/ControlsColumnTemplate' }),
|
2013-04-23 07:11:52 +00:00
|
|
|
headerCell: 'nzbDrone'
|
2013-04-23 00:35:04 +00:00
|
|
|
}
|
|
|
|
];
|
|
|
|
|
|
|
|
this.series.show(new Backgrid.Grid(
|
|
|
|
{
|
2013-04-25 04:27:49 +00:00
|
|
|
row : Backgrid.SeriesIndexTableRow,
|
|
|
|
columns : columns,
|
|
|
|
collection: this.seriesCollection,
|
|
|
|
className : 'table table-hover'
|
2013-04-23 00:35:04 +00:00
|
|
|
}));
|
|
|
|
},
|
|
|
|
|
|
|
|
showList: function () {
|
|
|
|
this.series.show(new NzbDrone.Series.Index.List.CollectionView({ collection: this.seriesCollection }));
|
|
|
|
},
|
|
|
|
|
2013-04-24 03:11:45 +00:00
|
|
|
showPosters: function () {
|
|
|
|
this.series.show(new NzbDrone.Series.Index.Posters.CollectionView({ collection: this.seriesCollection }));
|
|
|
|
},
|
|
|
|
|
2013-04-24 00:30:25 +00:00
|
|
|
showEmpty: function () {
|
|
|
|
this.series.show(new NzbDrone.Series.Index.EmptyView());
|
|
|
|
},
|
|
|
|
|
2013-04-23 00:35:04 +00:00
|
|
|
initialize: function () {
|
|
|
|
this.seriesCollection = new NzbDrone.Series.SeriesCollection();
|
|
|
|
this.seriesCollection.fetch();
|
|
|
|
},
|
|
|
|
|
|
|
|
onShow: function () {
|
2013-04-24 01:55:29 +00:00
|
|
|
|
2013-04-26 04:45:45 +00:00
|
|
|
var viewButtons = {
|
|
|
|
type : 'radio',
|
|
|
|
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
|
|
|
|
}
|
|
|
|
]
|
|
|
|
};
|
|
|
|
|
|
|
|
this.toolbar.show(new NzbDrone.Shared.Toolbar.ToolbarLayout({right: [ viewButtons], context: this}));
|
2013-04-23 00:35:04 +00:00
|
|
|
}
|
2013-04-26 04:45:45 +00:00
|
|
|
|
|
|
|
})
|
|
|
|
;
|
|
|
|
})
|
|
|
|
;
|