1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-11-01 00:12:30 +01:00
Sonarr/UI/Release/Layout.js

92 lines
2.8 KiB
JavaScript
Raw Normal View History

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