1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-16 11:37:58 +02:00
Sonarr/UI/Series/Index/SeriesIndexLayout.js

161 lines
5.6 KiB
JavaScript
Raw Normal View History

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