2013-06-22 08:24:24 +02:00
|
|
|
'use strict';
|
2013-06-25 01:41:59 +02:00
|
|
|
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 08:53:32 +02:00
|
|
|
template: 'History/HistoryLayoutTemplate',
|
|
|
|
|
|
|
|
regions: {
|
|
|
|
history: '#x-history',
|
|
|
|
toolbar: '#x-toolbar',
|
|
|
|
pager : '#x-pager'
|
|
|
|
},
|
|
|
|
|
2013-06-25 01:41:59 +02:00
|
|
|
columns:
|
|
|
|
[
|
|
|
|
{
|
2013-07-25 07:20:28 +02:00
|
|
|
name : 'eventType',
|
|
|
|
label : '',
|
|
|
|
cell : EventTypeCell,
|
|
|
|
cellValue: 'this'
|
2013-06-25 01:41:59 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
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 08:53:32 +02:00
|
|
|
|
2013-06-25 01:41:59 +02:00
|
|
|
_showTable: function (collection) {
|
2013-05-03 08:53:32 +02:00
|
|
|
|
2013-06-25 01:41:59 +02:00
|
|
|
this.history.show(new Backgrid.Grid({
|
|
|
|
columns : this.columns,
|
|
|
|
collection: collection,
|
|
|
|
className : 'table table-hover'
|
|
|
|
}));
|
2013-05-03 08:53:32 +02:00
|
|
|
|
2013-06-25 01:41:59 +02:00
|
|
|
this.pager.show(new GridPager({
|
2013-06-09 22:51:32 +02:00
|
|
|
columns : this.columns,
|
2013-06-25 01:41:59 +02:00
|
|
|
collection: collection
|
2013-05-03 08:53:32 +02:00
|
|
|
}));
|
|
|
|
},
|
|
|
|
|
2013-06-08 09:57:43 +02:00
|
|
|
onShow: function () {
|
|
|
|
var self = this;
|
|
|
|
|
2013-06-24 04:31:02 +02:00
|
|
|
this.history.show(new LoadingView());
|
2013-06-08 09:57:43 +02:00
|
|
|
|
2013-06-25 01:41:59 +02:00
|
|
|
var collection = new HistoryCollection();
|
|
|
|
collection.fetch().done(function () {
|
|
|
|
self._showTable(collection);
|
|
|
|
});
|
2013-05-03 08:53:32 +02:00
|
|
|
}
|
|
|
|
|
2013-06-25 01:41:59 +02:00
|
|
|
});
|
|
|
|
});
|