Lidarr/UI/History/HistoryLayout.js

108 lines
3.1 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
],
2013-06-24 02:31:02 +00:00
function (App,
HistoryCollection,
EventTypeCell,
RelativeDateCell,
TemplatedCell,
SeriesTitleCell,
EpisodeNumberCell,
EpisodeTitleCell,
QualityCell,
ToolbarLayout,
Pager,
HeaderCell,
LoadingView) {
return Backbone.Marionette.Layout.extend({
2013-05-03 06:53:32 +00:00
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:'',
2013-06-24 02:31:02 +00:00
cell : EventTypeCell
},
{
name : 'series',
label : 'Series',
2013-06-24 02:31:02 +00:00
cell : SeriesTitleCell
},
{
name : 'episode',
label : 'Episode',
sortable: false,
2013-06-24 02:31:02 +00:00
cell : EpisodeNumberCell
},
{
name : 'episode',
label : 'Episode Title',
sortable: false,
2013-06-24 02:31:02 +00:00
cell : EpisodeTitleCell
},
{
2013-06-24 02:31:02 +00:00
name : 'quality',
label : 'Quality',
cell : QualityCell
},
{
name : 'date',
label: 'Date',
2013-06-24 02:31:02 +00:00
cell : 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-24 02:31:02 +00:00
this.pager.show(new 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;
2013-06-24 02:31:02 +00:00
this.history.show(new LoadingView());
2013-06-08 07:57:43 +00:00
2013-06-24 02:31:02 +00:00
this.historyCollection = new HistoryCollection();
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}));
}
})
;
})
;