New: Mass series editor

This commit is contained in:
Mark McDowall 2013-12-08 21:25:27 -08:00
commit a9ece10144
26 changed files with 606 additions and 34 deletions

View file

@ -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();
}
});