diff options
Diffstat (limited to 'pyload/web/app/scripts/views/linkgrabber')
-rw-r--r-- | pyload/web/app/scripts/views/linkgrabber/collectorView.js | 4 | ||||
-rw-r--r-- | pyload/web/app/scripts/views/linkgrabber/modalView.js | 12 |
2 files changed, 14 insertions, 2 deletions
diff --git a/pyload/web/app/scripts/views/linkgrabber/collectorView.js b/pyload/web/app/scripts/views/linkgrabber/collectorView.js index 08b426aff..ba1bbbf69 100644 --- a/pyload/web/app/scripts/views/linkgrabber/collectorView.js +++ b/pyload/web/app/scripts/views/linkgrabber/collectorView.js @@ -21,6 +21,10 @@ define(['jquery', 'underscore', 'backbone', 'app', './packageView'], self.collection.add(pack); } + // set destination pid + if (self.model) + pack.set('pid', self.model.get('pid')); + // Remove links from other packages and delete empty ones self.collection.each(function(pack2) { console.log(pack2, links); diff --git a/pyload/web/app/scripts/views/linkgrabber/modalView.js b/pyload/web/app/scripts/views/linkgrabber/modalView.js index 8e24f259b..950c0ce2f 100644 --- a/pyload/web/app/scripts/views/linkgrabber/modalView.js +++ b/pyload/web/app/scripts/views/linkgrabber/modalView.js @@ -23,7 +23,15 @@ define(['jquery', 'underscore', 'backbone', 'app', 'models/CollectorPackage', 'v initialize: function() { // Inherit parent events this.events = _.extend({}, modalView.prototype.events, this.events); - this.listenTo(App.vent, 'package:added', _.bind(this.onAdded, this)); + this.listenTo(App.vent, 'collectorPackage:added', _.bind(this.onAdded, this)); + }, + + // sets a new models as target and render + setModel: function(model) { + if (this.model !== model) { + this.model = model; + this.render(); + } }, addOnKeyUp: function(e) { @@ -106,7 +114,7 @@ define(['jquery', 'underscore', 'backbone', 'app', 'models/CollectorPackage', 'v onRender: function() { // anonymous collection - this.collectorView = new CollectorView({collection: new (Backbone.Collection.extend({ + this.collectorView = new CollectorView({model: this.model, collection: new (Backbone.Collection.extend({ model: CollectorPackage }))()}); this.collectorView.setElement(this.$('.prepared-packages')); |