sonarr-repo-only/UI/History/HistoryLayout.js

96 lines
2.9 KiB
JavaScript
Raw Normal View History

2013-06-22 06:24:24 +00:00
'use strict';
2013-05-03 06:53:32 +00:00
define([
'app',
'History/Collection',
2013-06-11 01:55:05 +00:00
'History/EventTypeCell',
'Cells/RelativeDateCell',
'Cells/TemplatedCell',
'Cells/SeriesTitleCell',
'Cells/EpisodeNumberCell',
'Cells/EpisodeTitleCell',
'Cells/QualityCell',
2013-06-08 07:57:43 +00:00
'Shared/Toolbar/ToolbarLayout',
2013-06-14 00:41:46 +00:00
'Shared/Grid/Pager',
'Shared/Grid/HeaderCell',
2013-06-08 07:57:43 +00:00
'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: [
{
2013-06-11 01:55:05 +00:00
name: 'eventType',
label:'',
cell : NzbDrone.History.EventTypeCell
},
{
name : 'series',
label : 'Series',
cell : NzbDrone.Cells.SeriesTitleCell
},
{
name : 'episode',
label : 'Episode',
sortable: false,
cell : NzbDrone.Cells.EpisodeNumberCell
},
{
name : 'episode',
label : 'Episode Title',
sortable: false,
cell : NzbDrone.Cells.EpisodeTitleCell
},
{
name : 'quality',
label: 'Quality',
cell : NzbDrone.Cells.QualityCell
},
{
name : 'date',
label: 'Date',
cell : NzbDrone.Cells.RelativeDateCell
}
],
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'
}));
2013-06-14 00:41:46 +00:00
this.pager.show(new NzbDrone.Shared.Grid.Pager({
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}));
}
})
;
})
;