1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-21 01:49:57 +02:00
Sonarr/UI/Missing/MissingLayout.js

101 lines
3.1 KiB
JavaScript
Raw Normal View History

2013-06-22 09:24:24 +03:00
'use strict';
2013-06-21 08:35:56 +03:00
define(
[
'marionette',
'backgrid',
2013-06-21 08:35:56 +03:00
'Missing/Collection',
'Cells/SeriesTitleCell',
'Cells/EpisodeNumberCell',
'Cells/EpisodeTitleCell',
'Cells/RelativeDateCell',
2013-06-21 08:35:56 +03:00
'Shared/Grid/Pager',
'Shared/Toolbar/ToolbarLayout',
2013-06-21 08:35:56 +03:00
'Shared/LoadingView'
], function (Marionette, Backgrid, MissingCollection, SeriesTitleCell, EpisodeNumberCell, EpisodeTitleCell, RelativeDateCell, GridPager, ToolbarLayout, LoadingView) {
return Marionette.Layout.extend({
template: 'Missing/MissingLayoutTemplate',
regions: {
missing: '#x-missing',
2013-05-02 08:50:34 +03:00
toolbar: '#x-toolbar',
pager : '#x-pager'
},
2013-06-21 08:35:56 +03:00
columns:
[
{
name : 'series',
label : 'Series Title',
sortable: false,
2013-06-24 05:31:02 +03:00
cell : SeriesTitleCell
2013-06-21 08:35:56 +03:00
},
{
name : 'this',
label : 'Episode',
sortable: false,
2013-06-24 05:31:02 +03:00
cell : EpisodeNumberCell
2013-06-21 08:35:56 +03:00
},
{
name : 'this',
label : 'Episode Title',
sortable: false,
2013-06-24 05:31:02 +03:00
cell : EpisodeTitleCell
2013-06-21 08:35:56 +03:00
},
{
2013-07-25 03:27:45 +03:00
name : 'airDateUtc',
label: 'Air Date',
cell : RelativeDateCell
2013-06-21 08:35:56 +03:00
}
],
leftSideButtons: {
type : 'default',
storeState: false,
items :
[
{
title : 'Season Pass',
icon : 'icon-bookmark',
route : 'seasonpass'
}
]
},
2013-06-08 10:57:43 +03:00
_showTable: function () {
2013-06-21 08:35:56 +03:00
this.missing.show(new Backgrid.Grid({
columns : this.columns,
collection: this.missingCollection,
className : 'table table-hover'
}));
2013-05-02 08:50:34 +03:00
this.pager.show(new GridPager({
columns : this.columns,
2013-05-02 08:50:34 +03:00
collection: this.missingCollection
}));
},
onShow: function () {
2013-06-08 10:57:43 +03:00
var self = this;
2013-06-24 05:31:02 +03:00
this.missing.show(new LoadingView());
2013-06-08 10:57:43 +03:00
2013-06-24 05:31:02 +03:00
this.missingCollection = new MissingCollection();
2013-06-21 08:35:56 +03:00
this.missingCollection.fetch().done(function () {
self._showTable();
});
this._showToolbar();
},
_showToolbar: function () {
this.toolbar.show(new ToolbarLayout({
left :
[
this.leftSideButtons
],
context: this
}));
2013-06-08 10:57:43 +03:00
}
});
});