2013-06-22 06:24:24 +00:00
|
|
|
'use strict';
|
2013-06-21 05:35:56 +00:00
|
|
|
define(
|
|
|
|
[
|
2013-06-24 23:41:59 +00:00
|
|
|
'marionette',
|
|
|
|
'backgrid',
|
2013-06-21 05:35:56 +00:00
|
|
|
'Missing/Collection',
|
|
|
|
'Cells/SeriesTitleCell',
|
|
|
|
'Cells/EpisodeNumberCell',
|
|
|
|
'Cells/EpisodeTitleCell',
|
2013-07-26 02:09:17 +00:00
|
|
|
'Cells/RelativeDateCell',
|
2013-06-21 05:35:56 +00:00
|
|
|
'Shared/Grid/Pager',
|
2013-08-05 09:09:41 +00:00
|
|
|
'Shared/Toolbar/ToolbarLayout',
|
2013-06-21 05:35:56 +00:00
|
|
|
'Shared/LoadingView'
|
2013-08-05 09:09:41 +00:00
|
|
|
], function (Marionette, Backgrid, MissingCollection, SeriesTitleCell, EpisodeNumberCell, EpisodeTitleCell, RelativeDateCell, GridPager, ToolbarLayout, LoadingView) {
|
2013-06-24 23:41:59 +00:00
|
|
|
return Marionette.Layout.extend({
|
2013-05-01 03:04:06 +00:00
|
|
|
template: 'Missing/MissingLayoutTemplate',
|
|
|
|
|
|
|
|
regions: {
|
|
|
|
missing: '#x-missing',
|
2013-05-02 05:50:34 +00:00
|
|
|
toolbar: '#x-toolbar',
|
|
|
|
pager : '#x-pager'
|
2013-05-01 03:04:06 +00:00
|
|
|
},
|
|
|
|
|
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
|
|
|
},
|
|
|
|
{
|
2013-07-25 00:27:45 +00:00
|
|
|
name : 'airDateUtc',
|
2013-06-24 23:41:59 +00:00
|
|
|
label: 'Air Date',
|
2013-07-26 02:09:17 +00:00
|
|
|
cell : RelativeDateCell
|
2013-06-21 05:35:56 +00:00
|
|
|
}
|
|
|
|
],
|
2013-05-01 03:04:06 +00:00
|
|
|
|
2013-08-05 09:09:41 +00:00
|
|
|
leftSideButtons: {
|
|
|
|
type : 'default',
|
|
|
|
storeState: false,
|
|
|
|
items :
|
|
|
|
[
|
|
|
|
{
|
|
|
|
title : 'Season Pass',
|
|
|
|
icon : 'icon-bookmark',
|
|
|
|
route : 'seasonpass'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
|
2013-06-08 07:57:43 +00:00
|
|
|
_showTable: function () {
|
2013-06-21 05:35:56 +00:00
|
|
|
this.missing.show(new Backgrid.Grid({
|
2013-06-24 23:41:59 +00:00
|
|
|
columns : this.columns,
|
|
|
|
collection: this.missingCollection,
|
|
|
|
className : 'table table-hover'
|
|
|
|
}));
|
2013-05-02 05:50:34 +00:00
|
|
|
|
2013-06-24 23:41:59 +00:00
|
|
|
this.pager.show(new GridPager({
|
2013-06-09 20:51:32 +00:00
|
|
|
columns : this.columns,
|
2013-05-02 05:50:34 +00:00
|
|
|
collection: this.missingCollection
|
|
|
|
}));
|
2013-05-01 03:04:06 +00:00
|
|
|
},
|
|
|
|
|
2013-06-08 07:57:43 +00:00
|
|
|
|
2013-09-19 07:33:11 +00:00
|
|
|
initialize: function () {
|
2013-06-24 02:31:02 +00:00
|
|
|
this.missingCollection = new MissingCollection();
|
2013-08-05 09:09:41 +00:00
|
|
|
|
2013-09-19 07:33:11 +00:00
|
|
|
this.listenTo(this.missingCollection, 'sync', this._showTable);
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
onShow: function () {
|
|
|
|
this.missing.show(new LoadingView());
|
|
|
|
this.missingCollection.fetch();
|
2013-08-05 09:09:41 +00:00
|
|
|
this._showToolbar();
|
|
|
|
},
|
|
|
|
|
|
|
|
_showToolbar: function () {
|
|
|
|
this.toolbar.show(new ToolbarLayout({
|
|
|
|
left :
|
|
|
|
[
|
|
|
|
this.leftSideButtons
|
|
|
|
],
|
|
|
|
context: this
|
|
|
|
}));
|
2013-06-08 07:57:43 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|