1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-16 11:37:58 +02:00
Sonarr/UI/Missing/MissingLayout.js
2013-07-25 19:09:17 -07:00

75 lines
2.4 KiB
JavaScript

'use strict';
define(
[
'marionette',
'backgrid',
'Missing/Collection',
'Cells/SeriesTitleCell',
'Cells/EpisodeNumberCell',
'Cells/EpisodeTitleCell',
'Cells/RelativeDateCell',
'Shared/Grid/Pager',
'Shared/LoadingView'
], function (Marionette, Backgrid, MissingCollection, SeriesTitleCell, EpisodeNumberCell, EpisodeTitleCell, RelativeDateCell, GridPager, LoadingView) {
return Marionette.Layout.extend({
template: 'Missing/MissingLayoutTemplate',
regions: {
missing: '#x-missing',
toolbar: '#x-toolbar',
pager : '#x-pager'
},
columns:
[
{
name : 'series',
label : 'Series Title',
sortable: false,
cell : SeriesTitleCell
},
{
name : 'this',
label : 'Episode',
sortable: false,
cell : EpisodeNumberCell
},
{
name : 'this',
label : 'Episode Title',
sortable: false,
cell : EpisodeTitleCell
},
{
name : 'airDateUtc',
label: 'Air Date',
cell : RelativeDateCell
}
],
_showTable: function () {
this.missing.show(new Backgrid.Grid({
columns : this.columns,
collection: this.missingCollection,
className : 'table table-hover'
}));
this.pager.show(new GridPager({
columns : this.columns,
collection: this.missingCollection
}));
},
onShow: function () {
var self = this;
this.missing.show(new LoadingView());
this.missingCollection = new MissingCollection();
this.missingCollection.fetch().done(function () {
self._showTable();
});
}
});
});