2015-01-30 02:10:16 +00:00
|
|
|
'use strict';
|
2014-02-01 22:07:30 +00:00
|
|
|
define(
|
|
|
|
[
|
2014-10-12 07:29:09 +00:00
|
|
|
'Activity/Blacklist/BlacklistModel',
|
2014-02-01 22:07:30 +00:00
|
|
|
'backbone.pageable',
|
2014-07-04 20:07:03 +00:00
|
|
|
'Mixins/AsSortedCollection',
|
2014-02-01 22:07:30 +00:00
|
|
|
'Mixins/AsPersistedStateCollection'
|
2014-07-04 20:07:03 +00:00
|
|
|
], function (BlacklistModel, PageableCollection, AsSortedCollection, AsPersistedStateCollection) {
|
|
|
|
var Collection = PageableCollection.extend({
|
2014-02-01 22:07:30 +00:00
|
|
|
url : window.NzbDrone.ApiRoot + '/blacklist',
|
|
|
|
model: BlacklistModel,
|
|
|
|
|
|
|
|
state: {
|
|
|
|
pageSize: 15,
|
|
|
|
sortKey : 'date',
|
|
|
|
order : 1
|
|
|
|
},
|
|
|
|
|
|
|
|
queryParams: {
|
|
|
|
totalPages : null,
|
|
|
|
totalRecords: null,
|
|
|
|
pageSize : 'pageSize',
|
|
|
|
sortKey : 'sortKey',
|
|
|
|
order : 'sortDir',
|
|
|
|
directions : {
|
|
|
|
'-1': 'asc',
|
|
|
|
'1' : 'desc'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2014-07-04 20:07:03 +00:00
|
|
|
sortMappings: {
|
|
|
|
'series' : { sortKey: 'series.sortTitle' }
|
|
|
|
},
|
|
|
|
|
2014-02-01 22:07:30 +00:00
|
|
|
parseState: function (resp) {
|
|
|
|
return { totalRecords: resp.totalRecords };
|
|
|
|
},
|
|
|
|
|
|
|
|
parseRecords: function (resp) {
|
|
|
|
if (resp) {
|
|
|
|
return resp.records;
|
|
|
|
}
|
|
|
|
|
|
|
|
return resp;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2014-07-04 20:07:03 +00:00
|
|
|
Collection = AsSortedCollection.call(Collection);
|
|
|
|
return AsPersistedStateCollection.call(Collection);
|
2014-02-01 22:07:30 +00:00
|
|
|
});
|