sonarr-repo-only/UI/Missing/MissingLayout.js

75 lines
2.4 KiB
JavaScript
Raw Normal View History

2013-06-22 06:24:24 +00:00
'use strict';
2013-06-21 05:35:56 +00:00
define(
[
'marionette',
'backgrid',
2013-06-21 05:35:56 +00:00
'Missing/Collection',
'Cells/SeriesTitleCell',
'Cells/EpisodeNumberCell',
'Cells/EpisodeTitleCell',
'Cells/AirDateCell',
2013-06-21 05:35:56 +00:00
'Shared/Grid/Pager',
'Shared/LoadingView'
], function (Marionette, Backgrid, MissingCollection, SeriesTitleCell, EpisodeNumberCell, EpisodeTitleCell, AirDateCell, GridPager, LoadingView) {
return Marionette.Layout.extend({
template: 'Missing/MissingLayoutTemplate',
regions: {
missing: '#x-missing',
2013-05-02 05:50:34 +00:00
toolbar: '#x-toolbar',
pager : '#x-pager'
},
2013-06-21 05:35:56 +00:00
columns:
[
{
name : 'series',
label : 'Series Title',
sortable: false,
2013-06-24 02:31:02 +00:00
cell : SeriesTitleCell
2013-06-21 05:35:56 +00:00
},
{
name : 'this',
label : 'Episode',
sortable: false,
2013-06-24 02:31:02 +00:00
cell : EpisodeNumberCell
2013-06-21 05:35:56 +00:00
},
{
name : 'this',
label : 'Episode Title',
sortable: false,
2013-06-24 02:31:02 +00:00
cell : EpisodeTitleCell
2013-06-21 05:35:56 +00:00
},
{
name : 'airDate',
label: 'Air Date',
cell : AirDateCell
2013-06-21 05:35:56 +00:00
}
],
2013-06-08 07:57:43 +00:00
_showTable: function () {
2013-06-21 05:35:56 +00:00
this.missing.show(new Backgrid.Grid({
columns : this.columns,
collection: this.missingCollection,
className : 'table table-hover'
}));
2013-05-02 05:50:34 +00:00
this.pager.show(new GridPager({
columns : this.columns,
2013-05-02 05:50:34 +00:00
collection: this.missingCollection
}));
},
onShow: function () {
2013-06-08 07:57:43 +00:00
var self = this;
2013-06-24 02:31:02 +00:00
this.missing.show(new LoadingView());
2013-06-08 07:57:43 +00:00
2013-06-24 02:31:02 +00:00
this.missingCollection = new MissingCollection();
2013-06-21 05:35:56 +00:00
this.missingCollection.fetch().done(function () {
self._showTable();
});
2013-06-08 07:57:43 +00:00
}
});
});