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

107 lines
3.2 KiB
JavaScript
Raw Normal View History

2013-06-22 06:24:24 +00:00
'use strict';
define(
[
'marionette',
'backgrid',
'History/Collection',
'History/EventTypeCell',
'Cells/SeriesTitleCell',
'Cells/EpisodeNumberCell',
'Cells/EpisodeTitleCell',
'Cells/QualityCell',
'Cells/RelativeDateCell',
2013-08-26 05:31:58 +00:00
'History/HistoryDetailsCell',
'Shared/Grid/Pager',
'Shared/LoadingView'
2013-08-26 05:31:58 +00:00
], function (Marionette,
Backgrid,
HistoryCollection,
EventTypeCell,
SeriesTitleCell,
EpisodeNumberCell,
EpisodeTitleCell,
QualityCell,
RelativeDateCell,
HistoryDetailsCell,
GridPager,
LoadingView) {
return 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:
[
{
name : 'eventType',
label : '',
cell : EventTypeCell,
cellValue: 'this'
},
{
name : 'series',
label: 'Series',
cell : SeriesTitleCell
},
{
name : 'episode',
label : 'Episode',
sortable: false,
cell : EpisodeNumberCell
},
{
name : 'episode',
label : 'Episode Title',
sortable: false,
cell : EpisodeTitleCell
},
{
name : 'quality',
label: 'Quality',
cell : QualityCell
},
{
name : 'date',
label: 'Date',
cell : RelativeDateCell
2013-08-26 05:31:58 +00:00
},
{
name : 'this',
label : '',
cell : HistoryDetailsCell,
sortable: false
}
],
2013-05-03 06:53:32 +00:00
_showTable: function (collection) {
2013-05-03 06:53:32 +00:00
this.history.show(new Backgrid.Grid({
columns : this.columns,
collection: collection,
className : 'table table-hover'
}));
2013-05-03 06:53:32 +00:00
this.pager.show(new GridPager({
columns : this.columns,
collection: collection
2013-05-03 06:53:32 +00:00
}));
},
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
var collection = new HistoryCollection();
collection.fetch().done(function () {
self._showTable(collection);
});
2013-05-03 06:53:32 +00:00
}
});
});