NextAiring sorting is not as drunk anymore
This commit is contained in:
parent
642f56c221
commit
d89d9e67c2
|
@ -68,9 +68,11 @@ define(
|
||||||
var key = this.state.sortKey;
|
var key = this.state.sortKey;
|
||||||
var order = this.state.order;
|
var order = this.state.order;
|
||||||
|
|
||||||
if (this.sorters && this.sorters[key] && this.mode === 'client') {
|
if (this[key] && this.mode === 'client') {
|
||||||
var sortValue = this[key];
|
var sortValue = this[key];
|
||||||
|
|
||||||
|
this.setSorting(key, order, { sortValue: sortValue });
|
||||||
|
|
||||||
var comparator = this._makeComparator(key, order, sortValue);
|
var comparator = this._makeComparator(key, order, sortValue);
|
||||||
this.fullCollection.comparator = comparator;
|
this.fullCollection.comparator = comparator;
|
||||||
this.fullCollection.sort();
|
this.fullCollection.sort();
|
||||||
|
|
|
@ -75,7 +75,7 @@ define(
|
||||||
name : 'nextAiring',
|
name : 'nextAiring',
|
||||||
label : 'Next Airing',
|
label : 'Next Airing',
|
||||||
cell : RelativeDateCell,
|
cell : RelativeDateCell,
|
||||||
sortValue : SeriesCollection.sorters.nextAiring
|
sortValue : SeriesCollection.nextAiring
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name : 'percentOfEpisodes',
|
name : 'percentOfEpisodes',
|
||||||
|
@ -152,7 +152,7 @@ define(
|
||||||
{
|
{
|
||||||
title : 'Next Airing',
|
title : 'Next Airing',
|
||||||
name : 'nextAiring',
|
name : 'nextAiring',
|
||||||
sortValue : SeriesCollection.sorters.nextAiring
|
sortValue : SeriesCollection.nextAiring
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Episodes',
|
title: 'Episodes',
|
||||||
|
|
|
@ -20,18 +20,6 @@ define(
|
||||||
pageSize: 1000
|
pageSize: 1000
|
||||||
},
|
},
|
||||||
|
|
||||||
sorters: {
|
|
||||||
nextAiring: function (model) {
|
|
||||||
var nextAiring = model.get('nextAiring');
|
|
||||||
|
|
||||||
if (!nextAiring) {
|
|
||||||
return Number.MAX_VALUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Moment(nextAiring).unix();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
mode: 'client',
|
mode: 'client',
|
||||||
|
|
||||||
save: function () {
|
save: function () {
|
||||||
|
@ -57,6 +45,17 @@ define(
|
||||||
});
|
});
|
||||||
|
|
||||||
return proxy.save();
|
return proxy.save();
|
||||||
|
},
|
||||||
|
|
||||||
|
//Sorters
|
||||||
|
nextAiring: function (model, attr) {
|
||||||
|
var nextAiring = model.get(attr);
|
||||||
|
|
||||||
|
if (!nextAiring) {
|
||||||
|
return Number.MAX_VALUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Moment(nextAiring).unix();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue