From c3c7387390843dc4bbeca46580a3e0c195cffaa5 Mon Sep 17 00:00:00 2001 From: Devin Buhl Date: Mon, 30 Jan 2017 17:21:56 -0500 Subject: [PATCH] add importfromlist abck --- src/UI/Movies/MoviesCollection.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/UI/Movies/MoviesCollection.js b/src/UI/Movies/MoviesCollection.js index 56a0170f8..ae8993805 100644 --- a/src/UI/Movies/MoviesCollection.js +++ b/src/UI/Movies/MoviesCollection.js @@ -47,6 +47,27 @@ var Collection = PageableCollection.extend({ return proxy.save(); }, + importFromList : function(models) { + var self = this; + + var proxy = _.extend(new Backbone.Model(), { + id : "", + + url : self.url + "/import", + + toJSON : function() { + return models; + } + }); + + this.listenTo(proxy, "sync", function(proxyModel, models) { + this.add(models, { merge : true}); + this.trigger("save", this); + }); + + return proxy.save(); + }, + filterModes : { 'all' : [ null,