1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-16 11:37:58 +02:00
Sonarr/UI/History/HistoryLayout.js

88 lines
2.7 KiB
JavaScript
Raw Normal View History

2013-06-22 09:24:24 +03:00
'use strict';
define(
[
'marionette',
'backgrid',
'History/Collection',
'History/EventTypeCell',
'Cells/SeriesTitleCell',
'Cells/EpisodeNumberCell',
'Cells/EpisodeTitleCell',
'Cells/QualityCell',
'Cells/RelativeDateCell',
'Shared/Grid/Pager',
'Shared/LoadingView'
], function (Marionette, Backgrid, HistoryCollection, EventTypeCell, SeriesTitleCell, EpisodeNumberCell, EpisodeTitleCell, QualityCell, RelativeDateCell, GridPager, LoadingView) {
return Marionette.Layout.extend({
2013-05-03 09:53:32 +03:00
template: 'History/HistoryLayoutTemplate',
regions: {
history: '#x-history',
toolbar: '#x-toolbar',
pager : '#x-pager'
},
columns:
[
{
name : 'eventType',
label: '',
cell : EventTypeCell
},
{
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-05-03 09:53:32 +03:00
_showTable: function (collection) {
2013-05-03 09:53:32 +03:00
this.history.show(new Backgrid.Grid({
columns : this.columns,
collection: collection,
className : 'table table-hover'
}));
2013-05-03 09:53:32 +03:00
this.pager.show(new GridPager({
columns : this.columns,
collection: collection
2013-05-03 09:53:32 +03:00
}));
},
2013-06-08 10:57:43 +03:00
onShow: function () {
var self = this;
2013-06-24 05:31:02 +03:00
this.history.show(new LoadingView());
2013-06-08 10:57:43 +03:00
var collection = new HistoryCollection();
collection.fetch().done(function () {
self._showTable(collection);
});
2013-05-03 09:53:32 +03:00
}
});
});