mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-20 21:54:25 -04:00
New: Mass series editor
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
'use strict';
|
||||
define(
|
||||
[
|
||||
'underscore',
|
||||
'backbone',
|
||||
'Series/SeriesModel',
|
||||
'api!series'
|
||||
], function (Backbone, SeriesModel, SeriesData) {
|
||||
], function (_, Backbone, SeriesModel, SeriesData) {
|
||||
var Collection = Backbone.Collection.extend({
|
||||
url : window.NzbDrone.ApiRoot + '/series',
|
||||
model: SeriesModel,
|
||||
@@ -16,6 +17,30 @@ define(
|
||||
state: {
|
||||
sortKey: 'title',
|
||||
order : -1
|
||||
},
|
||||
|
||||
save: function () {
|
||||
var self = this;
|
||||
|
||||
var proxy = _.extend( new Backbone.Model(),
|
||||
{
|
||||
id: '',
|
||||
|
||||
url: self.url + '/editor',
|
||||
|
||||
toJSON: function()
|
||||
{
|
||||
return self.filter(function (model) {
|
||||
return model.hasChanged();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
this.listenTo(proxy, 'sync', function (proxyModel, models) {
|
||||
this.add(models, { merge: true });
|
||||
});
|
||||
|
||||
return proxy.save();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user