2013-08-07 06:48:28 +00:00
|
|
|
'use strict';
|
|
|
|
define(
|
|
|
|
[
|
2013-08-22 00:56:25 +00:00
|
|
|
'app',
|
2013-08-07 06:48:28 +00:00
|
|
|
'marionette',
|
|
|
|
'backgrid',
|
|
|
|
'Cells/FileSizeCell',
|
|
|
|
'Cells/QualityCell',
|
|
|
|
'Episode/Summary/NoFileView'
|
2013-08-22 03:24:50 +00:00
|
|
|
], function (App, Marionette, Backgrid, FileSizeCell, QualityCell, NoFileView) {
|
2013-08-07 06:48:28 +00:00
|
|
|
|
|
|
|
return Marionette.Layout.extend({
|
|
|
|
template: 'Episode/Summary/LayoutTemplate',
|
|
|
|
|
|
|
|
regions: {
|
|
|
|
overview: '.episode-overview',
|
|
|
|
activity: '.episode-file-info'
|
|
|
|
},
|
|
|
|
|
|
|
|
columns:
|
|
|
|
[
|
|
|
|
{
|
|
|
|
name : 'path',
|
|
|
|
label : 'Path',
|
|
|
|
cell : 'string',
|
|
|
|
sortable: false
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name : 'size',
|
|
|
|
label : 'Size',
|
|
|
|
cell : FileSizeCell,
|
|
|
|
sortable: false
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name : 'quality',
|
|
|
|
label : 'Quality',
|
|
|
|
cell : QualityCell,
|
2013-08-20 23:35:19 +00:00
|
|
|
sortable: false,
|
|
|
|
editable: true
|
2013-08-07 06:48:28 +00:00
|
|
|
}
|
|
|
|
],
|
|
|
|
|
2013-08-21 22:26:16 +00:00
|
|
|
templateHelpers: {},
|
|
|
|
|
|
|
|
initialize: function (options) {
|
|
|
|
if (!this.model.series) {
|
|
|
|
this.templateHelpers.series = options.series.toJSON();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2013-08-07 06:48:28 +00:00
|
|
|
onShow: function () {
|
2013-08-22 00:56:25 +00:00
|
|
|
if (this.model.get('hasFile')) {
|
|
|
|
var episodeFile = App.request(App.Reqres.GetEpisodeFileById, this.model.get('episodeFileId'));
|
|
|
|
|
2013-08-07 06:48:28 +00:00
|
|
|
this.activity.show(new Backgrid.Grid({
|
2013-08-22 03:24:50 +00:00
|
|
|
collection: new Backbone.Collection(episodeFile),
|
2013-08-07 06:48:28 +00:00
|
|
|
columns : this.columns,
|
|
|
|
className : 'table table-bordered'
|
|
|
|
}));
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
this.activity.show(new NoFileView());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|