Lidarr/UI/Release/Layout.js

93 lines
2.8 KiB
JavaScript
Raw Normal View History

2013-06-22 06:24:24 +00:00
'use strict';
define([
'app',
'Release/Collection',
'Release/ApprovalStatusCell',
'Shared/SpinnerView',
2013-06-07 23:54:46 +00:00
'Shared/Toolbar/ToolbarLayout',
'Cells/EpisodeNumberCell',
'Cells/FileSizeCell',
2013-06-10 02:16:48 +00:00
'Cells/IndexerCell',
'Cells/QualityCell'
],
function () {
NzbDrone.Release.Layout = Backbone.Marionette.Layout.extend({
template: 'Release/LayoutTemplate',
regions: {
grid : '#x-grid',
toolbar: '#x-toolbar'
},
columns: [
{
name : 'indexer',
label : 'Indexer',
sortable: true,
cell : NzbDrone.Cells.IndexerCell
},
2013-06-10 02:16:48 +00:00
{
name : 'title',
label : 'Title',
sortable: true,
cell : Backgrid.StringCell
},
{
2013-06-07 23:54:46 +00:00
name : 'episodeNumbers',
episodes: 'episodeNumbers',
label : 'season',
cell : NzbDrone.Cells.EpisodeNumberCell
},
2013-06-10 02:16:48 +00:00
{
name : 'size',
label : 'Size',
sortable: true,
cell : NzbDrone.Cells.FileSizeCell
},
{
name : 'quality',
label : 'Quality',
sortable: true,
cell : NzbDrone.Cells.QualityCell
},
{
2013-06-07 23:54:46 +00:00
name : 'rejections',
label: 'decision',
cell : NzbDrone.Release.ApprovalStatusCell
}
],
showTable: function () {
2013-06-07 23:54:46 +00: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 NzbDrone.Release.Collection();
this.fetchPromise = this.collection.fetch();
},
onShow: function () {
var self = this;
this.grid.show(new NzbDrone.Shared.SpinnerView());
this.fetchPromise.done(function () {
self.showTable();
});
//this.toolbar.show(new NzbDrone.Shared.Toolbar.ToolbarLayout({right: [ viewButtons], context: this}));
}
});
});