2013-06-22 06:24:24 +00:00
|
|
|
'use strict';
|
2013-06-24 23:41:59 +00:00
|
|
|
define(
|
|
|
|
[
|
|
|
|
'marionette',
|
|
|
|
'backgrid',
|
|
|
|
'Release/Collection',
|
|
|
|
'Cells/IndexerCell',
|
|
|
|
'Cells/EpisodeNumberCell',
|
|
|
|
'Cells/FileSizeCell',
|
|
|
|
'Cells/QualityCell',
|
2013-07-03 00:44:22 +00:00
|
|
|
'Cells/ApprovalStatusCell',
|
2013-08-22 04:04:03 +00:00
|
|
|
'Shared/LoadingView'
|
|
|
|
], function (Marionette, Backgrid, ReleaseCollection, IndexerCell, EpisodeNumberCell, FileSizeCell, QualityCell, ApprovalStatusCell, LoadingView) {
|
2013-06-24 23:41:59 +00:00
|
|
|
return Marionette.Layout.extend({
|
2013-06-05 05:38:15 +00:00
|
|
|
template: 'Release/LayoutTemplate',
|
|
|
|
|
|
|
|
regions: {
|
|
|
|
grid : '#x-grid',
|
|
|
|
toolbar: '#x-toolbar'
|
|
|
|
},
|
|
|
|
|
2013-06-24 23:41:59 +00:00
|
|
|
columns:
|
|
|
|
[
|
|
|
|
{
|
|
|
|
name : 'indexer',
|
|
|
|
label : 'Indexer',
|
|
|
|
sortable: true,
|
|
|
|
cell : IndexerCell
|
|
|
|
},
|
2013-06-10 02:16:48 +00:00
|
|
|
|
2013-06-24 23:41:59 +00:00
|
|
|
{
|
|
|
|
name : 'title',
|
|
|
|
label : 'Title',
|
|
|
|
sortable: true,
|
|
|
|
cell : Backgrid.StringCell
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name : 'episodeNumbers',
|
|
|
|
episodes: 'episodeNumbers',
|
|
|
|
label : 'season',
|
|
|
|
cell : EpisodeNumberCell
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name : 'size',
|
|
|
|
label : 'Size',
|
|
|
|
sortable: true,
|
|
|
|
cell : FileSizeCell
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name : 'quality',
|
|
|
|
label : 'Quality',
|
|
|
|
sortable: true,
|
|
|
|
cell : QualityCell
|
|
|
|
},
|
2013-06-10 02:16:48 +00:00
|
|
|
|
2013-06-24 23:41:59 +00:00
|
|
|
{
|
|
|
|
name : 'rejections',
|
2013-07-03 00:44:22 +00:00
|
|
|
label: '',
|
2013-06-24 23:41:59 +00:00
|
|
|
cell : ApprovalStatusCell
|
|
|
|
}
|
|
|
|
],
|
2013-06-05 05:38:15 +00:00
|
|
|
|
|
|
|
showTable: function () {
|
2013-06-07 23:54:46 +00:00
|
|
|
if (!this.isClosed) {
|
2013-06-24 23:41:59 +00:00
|
|
|
this.grid.show(new Backgrid.Grid({
|
|
|
|
row : Backgrid.Row,
|
|
|
|
columns : this.columns,
|
|
|
|
collection: this.collection,
|
|
|
|
className : 'table table-hover'
|
|
|
|
}));
|
2013-06-05 05:38:15 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
initialize: function () {
|
2013-06-24 23:41:59 +00:00
|
|
|
this.collection = new ReleaseCollection();
|
2013-06-05 05:38:15 +00:00
|
|
|
this.fetchPromise = this.collection.fetch();
|
|
|
|
},
|
|
|
|
|
|
|
|
onShow: function () {
|
|
|
|
|
|
|
|
var self = this;
|
|
|
|
|
2013-08-22 04:04:03 +00:00
|
|
|
this.grid.show(new LoadingView());
|
2013-06-05 05:38:15 +00:00
|
|
|
|
|
|
|
this.fetchPromise.done(function () {
|
|
|
|
self.showTable();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|