Allow series grid sorting by episodes (percent downloaded)

pull/3113/head
Mark McDowall 11 years ago
parent 0a7401c180
commit 59c033dd68

@ -0,0 +1,33 @@
'use strict';
define(
[
'marionette',
'Cells/NzbDroneCell'
], function (Marionette, NzbDroneCell) {
return NzbDroneCell.extend({
className: 'episode-progress-cell',
template : 'Cells/EpisodeProgressCellTemplate',
render: function () {
var episodeCount = this.model.get('episodeCount');
var episodeFileCount = this.model.get('episodeFileCount');
var percent = 100;
if (episodeCount > 0) {
percent = episodeFileCount / episodeCount * 100;
}
this.model.set('percentOfEpisodes', percent);
this.templateFunction = Marionette.TemplateCache.get(this.template);
var data = this.model.toJSON();
var html = this.templateFunction(data);
this.$el.html(html);
return this;
}
});
});

@ -10,14 +10,13 @@ define(
'Cells/SeriesTitleCell', 'Cells/SeriesTitleCell',
'Cells/TemplatedCell', 'Cells/TemplatedCell',
'Cells/QualityProfileCell', 'Cells/QualityProfileCell',
'Cells/EpisodeProgressCell',
'Shared/Grid/DateHeaderCell', 'Shared/Grid/DateHeaderCell',
'Series/Index/Table/SeriesStatusCell', 'Series/Index/Table/SeriesStatusCell',
'Series/Index/Table/SeriesStatusHeaderCell',
'Series/Index/Table/Row', 'Series/Index/Table/Row',
'Series/Index/FooterView', 'Series/Index/FooterView',
'Series/Index/FooterModel', 'Series/Index/FooterModel',
'Shared/Toolbar/ToolbarLayout', 'Shared/Toolbar/ToolbarLayout'
'Shared/LoadingView'
], function (Marionette, ], function (Marionette,
PosterCollectionView, PosterCollectionView,
ListCollectionView, ListCollectionView,
@ -27,14 +26,13 @@ define(
SeriesTitleCell, SeriesTitleCell,
TemplatedCell, TemplatedCell,
QualityProfileCell, QualityProfileCell,
EpisodeProgressCell,
DateHeaderCell, DateHeaderCell,
SeriesStatusCell, SeriesStatusCell,
SeriesStatusHeaderCell,
SeriesIndexRow, SeriesIndexRow,
FooterView, FooterView,
FooterModel, FooterModel,
ToolbarLayout, ToolbarLayout) {
LoadingView) {
return Marionette.Layout.extend({ return Marionette.Layout.extend({
template: 'Series/Index/SeriesIndexLayoutTemplate', template: 'Series/Index/SeriesIndexLayoutTemplate',
@ -79,11 +77,9 @@ define(
headerCell: DateHeaderCell headerCell: DateHeaderCell
}, },
{ {
name : 'this', name : 'percentOfEpisodes',
label : 'Episodes', label : 'Episodes',
sortable: false, cell : EpisodeProgressCell,
template: 'Series/EpisodeProgressTemplate',
cell : TemplatedCell,
className: 'episode-progress-cell' className: 'episode-progress-cell'
}, },
{ {

Loading…
Cancel
Save