1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-11-01 08:22:35 +01:00
Sonarr/UI/Series/Index/SeriesIndexLayout.js

184 lines
6.8 KiB
JavaScript
Raw Normal View History

2013-04-23 02:35:04 +02:00
"use strict";
define([
'app',
'Series/Index/List/CollectionView',
2013-04-24 05:11:45 +02:00
'Series/Index/Posters/CollectionView',
2013-04-24 02:30:25 +02:00
'Series/Index/EmptyView',
'Series/Index/Table/AirDateCell',
2013-04-25 06:27:49 +02:00
'Series/Index/Table/SeriesStatusCell',
'Shared/Toolbar/ToolbarLayout',
'Config'
2013-04-23 02:35:04 +02:00
],
2013-04-23 04:07:21 +02:00
function () {
2013-04-23 02:35:04 +02:00
NzbDrone.Series.Index.SeriesIndexLayout = Backbone.Marionette.Layout.extend({
template: 'Series/Index/SeriesIndexLayoutTemplate',
regions: {
series : '#x-series',
toolbar: '#x-toolbar'
2013-04-23 02:35:04 +02:00
},
showTable: function () {
2013-04-25 06:27:49 +02:00
var columns = [
2013-04-23 02:35:04 +02:00
{
2013-04-25 06:27:49 +02:00
name : 'status',
label : '',
editable : false,
cell : 'seriesStatus',
2013-04-23 09:11:52 +02:00
headerCell: 'nzbDrone'
2013-04-23 02:35:04 +02:00
},
{
2013-04-25 06:27:49 +02:00
name : 'title',
label : 'Title',
editable : false,
cell : Backgrid.TemplateBackedCell.extend({ template: 'Series/Index/Table/SeriesTitleTemplate' }),
2013-04-23 09:11:52 +02:00
headerCell: 'nzbDrone'
2013-04-23 02:35:04 +02:00
},
{
2013-04-25 06:27:49 +02:00
name : 'seasonCount',
label : 'Seasons',
editable : false,
cell : 'integer',
2013-04-23 09:11:52 +02:00
headerCell: 'nzbDrone'
2013-04-23 02:35:04 +02:00
},
{
2013-04-25 06:27:49 +02:00
name : 'quality',
label : 'Quality',
editable : false,
cell : 'integer',
2013-04-23 09:11:52 +02:00
headerCell: 'nzbDrone'
2013-04-23 02:35:04 +02:00
},
{
2013-04-25 06:27:49 +02:00
name : 'network',
label : 'Network',
editable : false,
cell : 'string',
2013-04-23 09:11:52 +02:00
headerCell: 'nzbDrone'
2013-04-23 02:35:04 +02:00
},
{
2013-04-25 06:27:49 +02:00
name : 'nextAiring',
label : 'Next Airing',
editable : false,
cell : 'airDate',
2013-04-23 09:11:52 +02:00
headerCell: 'nzbDrone'
2013-04-23 02:35:04 +02:00
},
{
2013-04-25 06:27:49 +02:00
name : 'episodes',
label : 'Episodes',
editable : false,
sortable : false,
cell : Backgrid.TemplateBackedCell.extend({ template: 'Series/EpisodeProgressTemplate' }),
2013-04-23 09:11:52 +02:00
headerCell: 'nzbDrone'
2013-04-23 02:35:04 +02:00
},
{
2013-04-25 06:27:49 +02:00
name : 'edit',
label : '',
editable : false,
sortable : false,
cell : Backgrid.TemplateBackedCell.extend({ template: 'Series/Index/Table/ControlsColumnTemplate' }),
2013-04-23 09:11:52 +02:00
headerCell: 'nzbDrone'
2013-04-23 02:35:04 +02:00
}
];
this.series.show(new Backgrid.Grid(
{
row : NzbDrone.Series.Index.Table.Row,
2013-04-25 06:27:49 +02:00
columns : columns,
collection: this.seriesCollection,
className : 'table table-hover'
2013-04-23 02:35:04 +02:00
}));
},
showList: function () {
this.series.show(new NzbDrone.Series.Index.List.CollectionView({ collection: this.seriesCollection }));
},
2013-04-24 05:11:45 +02:00
showPosters: function () {
this.series.show(new NzbDrone.Series.Index.Posters.CollectionView({ collection: this.seriesCollection }));
},
2013-04-24 02:30:25 +02:00
showEmpty: function () {
this.series.show(new NzbDrone.Series.Index.EmptyView());
},
2013-04-23 02:35:04 +02:00
initialize: function () {
this.seriesCollection = new NzbDrone.Series.SeriesCollection();
this.seriesCollection.fetch();
},
onShow: function () {
var viewButtons = {
type : 'radio',
2013-05-11 22:51:32 +02:00
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
}
]
};
2013-05-11 22:51:32 +02:00
var leftSideButtons = {
type : 'default',
storeState: false,
items : [
{
title: 'Add Series',
icon : 'icon-plus',
route: 'series/add'
},
{
2013-05-12 01:39:32 +02:00
title : 'RSS Sync',
icon : 'icon-rss',
command : 'rsssync',
successMessage: 'RSS Sync Completed',
errorMessage : 'RSS Sync Failed!'
2013-05-11 22:51:32 +02:00
},
{
2013-05-12 01:39:32 +02:00
title : 'Update Library',
icon : 'icon-refresh',
command : 'diskscan',
2013-05-12 01:39:32 +02:00
successMessage: 'Library was updated!',
errorMessage : 'Library update failed!'
},
{
title : 'Test Action',
icon : 'icon-asterisk',
command : 'test',
successMessage: 'Test Completed',
errorMessage : 'Test Failed!'
2013-05-11 22:51:32 +02:00
}
]
};
this.toolbar.show(new NzbDrone.Shared.Toolbar.ToolbarLayout({
right : [ viewButtons],
left : [ leftSideButtons],
context: this
}));
2013-04-23 02:35:04 +02:00
}
})
;
})
;