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