mirror of https://github.com/Radarr/Radarr
New: Sort queue by series, episode and episode title
This commit is contained in:
parent
9cf575c096
commit
f13a4b5aa5
|
@ -1,7 +1,9 @@
|
||||||
var _ = require('underscore');
|
var _ = require('underscore');
|
||||||
var Backbone = require('backbone');
|
|
||||||
var PageableCollection = require('backbone.pageable');
|
var PageableCollection = require('backbone.pageable');
|
||||||
var QueueModel = require('./QueueModel');
|
var QueueModel = require('./QueueModel');
|
||||||
|
var FormatHelpers = require('../../Shared/FormatHelpers');
|
||||||
|
var AsSortedCollection = require('../../Mixins/AsSortedCollection');
|
||||||
|
|
||||||
require('../../Mixins/backbone.signalr.mixin');
|
require('../../Mixins/backbone.signalr.mixin');
|
||||||
|
|
||||||
var QueueCollection = PageableCollection.extend({
|
var QueueCollection = PageableCollection.extend({
|
||||||
|
@ -18,10 +20,39 @@ var QueueCollection = PageableCollection.extend({
|
||||||
return _.find(this.fullCollection.models, function(queueModel) {
|
return _.find(this.fullCollection.models, function(queueModel) {
|
||||||
return queueModel.get('episode').id === episodeId;
|
return queueModel.get('episode').id === episodeId;
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
sortMappings : {
|
||||||
|
series : {
|
||||||
|
sortValue : function(model, attr) {
|
||||||
|
var series = model.get(attr);
|
||||||
|
|
||||||
|
return series.get('sortTitle');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
episode : {
|
||||||
|
sortValue : function(model, attr) {
|
||||||
|
var episode = model.get('episode');
|
||||||
|
|
||||||
|
return FormatHelpers.pad(episode.get('seasonNumber'), 4) + FormatHelpers.pad(episode.get('episodeNumber'), 4);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
episodeTitle : {
|
||||||
|
sortValue : function(model, attr) {
|
||||||
|
var episode = model.get('episode');
|
||||||
|
|
||||||
|
return episode.get('title');
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
QueueCollection = AsSortedCollection.call(QueueCollection);
|
||||||
|
|
||||||
var collection = new QueueCollection().bindSignalR();
|
var collection = new QueueCollection().bindSignalR();
|
||||||
collection.fetch();
|
collection.fetch();
|
||||||
|
|
||||||
|
|
||||||
module.exports = collection;
|
module.exports = collection;
|
|
@ -30,20 +30,18 @@ module.exports = Marionette.Layout.extend({
|
||||||
{
|
{
|
||||||
name : 'series',
|
name : 'series',
|
||||||
label : 'Series',
|
label : 'Series',
|
||||||
cell : SeriesTitleCell,
|
cell : SeriesTitleCell
|
||||||
sortable : false
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name : 'episode',
|
name : 'episode',
|
||||||
label : 'Episode',
|
label : 'Episode',
|
||||||
cell : EpisodeNumberCell,
|
cell : EpisodeNumberCell
|
||||||
sortable : false
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name : 'episode',
|
name : 'episodeTitle',
|
||||||
label : 'Episode Title',
|
label : 'Episode Title',
|
||||||
cell : EpisodeTitleCell,
|
cell : EpisodeTitleCell,
|
||||||
sortable : false
|
cellValue : 'episode'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name : 'quality',
|
name : 'quality',
|
||||||
|
|
|
@ -33,6 +33,10 @@ module.exports = Backgrid.Cell.extend({
|
||||||
if (cellValue === 'this') {
|
if (cellValue === 'this') {
|
||||||
return this.model;
|
return this.model;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else {
|
||||||
|
return this.model.get(cellValue);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var name = this.column.get('name');
|
var name = this.column.get('name');
|
||||||
|
|
Loading…
Reference in New Issue