Sonarr/UI/History/HistoryLayout.js

94 lines
3.3 KiB
JavaScript
Raw Normal View History

2013-05-03 06:53:32 +00:00
"use strict";
define([
'app',
'History/Collection',
'Series/Index/Table/AirDateCell',
2013-06-08 07:57:43 +00:00
'Shared/Toolbar/ToolbarLayout',
'Shared/LoadingView'
2013-05-03 06:53:32 +00:00
],
function () {
NzbDrone.History.HistoryLayout = Backbone.Marionette.Layout.extend({
template: 'History/HistoryLayoutTemplate',
regions: {
history: '#x-history',
toolbar: '#x-toolbar',
pager : '#x-pager'
},
columns: [
{
name : 'indexer',
label : '',
cell : Backgrid.TemplateBackedCell.extend({ template: 'History/IndexerTemplate' })
},
{
name : 'Series.Title',
label : 'Series Title',
cell : Backgrid.TemplateBackedCell.extend({ template: 'Missing/SeriesTitleTemplate' })
},
{
name : 'episode',
label : 'Episode',
sortable : false,
cell : Backgrid.TemplateBackedCell.extend({ template: 'Missing/EpisodeColumnTemplate' })
},
{
name : 'Episode.Title',
label : 'Episode Title',
sortable : false,
cell : Backgrid.TemplateBackedCell.extend({ template: 'History/EpisodeTitleTemplate' })
},
{
name : 'quality',
label : 'Quality',
cell : Backgrid.TemplateBackedCell.extend({ template: 'History/QualityTemplate' })
},
{
name : 'date',
label : 'Grabbed',
cell : 'airDate'
},
{
name : 'edit',
label : '',
sortable : false,
cell : Backgrid.TemplateBackedCell.extend({ template: 'History/ControlsColumnTemplate' })
}
],
2013-05-03 06:53:32 +00:00
2013-06-08 07:57:43 +00:00
_showTable: function () {
2013-05-03 06:53:32 +00:00
this.history.show(new Backgrid.Grid(
{
row : NzbDrone.History.Row,
columns : this.columns,
2013-05-03 06:53:32 +00:00
collection: this.historyCollection,
className : 'table table-hover'
}));
this.pager.show(new Backgrid.NzbDronePaginator({
columns: this.columns,
2013-05-03 06:53:32 +00:00
collection: this.historyCollection
}));
},
2013-06-08 07:57:43 +00:00
onShow: function () {
var self = this;
this.history.show(new NzbDrone.Shared.LoadingView());
2013-05-03 06:53:32 +00:00
this.historyCollection = new NzbDrone.History.Collection();
2013-06-08 07:57:43 +00:00
this.historyCollection.fetch()
.done(function () {
self._showTable();
});
2013-05-03 06:53:32 +00:00
//this.toolbar.show(new NzbDrone.Shared.Toolbar.ToolbarLayout({right: [ viewButtons], context: this}));
}
})
;
})
;