1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-21 01:49:57 +02:00
Sonarr/UI/Release/Layout.js

92 lines
2.8 KiB
JavaScript
Raw Normal View History

2013-06-22 09:24:24 +03:00
'use strict';
define(
[
'marionette',
'backgrid',
'Release/Collection',
'Cells/IndexerCell',
'Cells/EpisodeNumberCell',
'Cells/FileSizeCell',
'Cells/QualityCell',
'Cells/ApprovalStatusCell',
2013-08-22 07:04:03 +03: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 05:16:48 +03: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 05:16:48 +03:00
{
name : 'rejections',
label: '',
cell : ApprovalStatusCell
}
],
showTable: function () {
2013-06-08 02:54:46 +03: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 07:04:03 +03:00
this.grid.show(new LoadingView());
this.fetchPromise.done(function () {
self.showTable();
});
}
});
});