diff options
Diffstat (limited to 'pyload/web/app/scripts/views/linkgrabber/modalView.js')
-rw-r--r-- | pyload/web/app/scripts/views/linkgrabber/modalView.js | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/pyload/web/app/scripts/views/linkgrabber/modalView.js b/pyload/web/app/scripts/views/linkgrabber/modalView.js index 6e4781ac2..32730658c 100644 --- a/pyload/web/app/scripts/views/linkgrabber/modalView.js +++ b/pyload/web/app/scripts/views/linkgrabber/modalView.js @@ -4,6 +4,7 @@ define(['jquery', 'underscore', 'backbone', 'app', 'models/CollectorPackage', 'v // Modal dialog for package adding - triggers package:added when package was added return modalView.extend({ + className: 'modal linkgrabber', events: { 'keypress #inputLinks': 'addOnEnter' }, @@ -16,6 +17,7 @@ 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)); }, addOnEnter: function(e) { @@ -44,6 +46,14 @@ define(['jquery', 'underscore', 'backbone', 'app', 'models/CollectorPackage', 'v this.$('#inputLinks').val(''); }, + // Hide when there are no more packages + onAdded: function() { + if (this.collectorView !== null) { + if (this.collectorView.collection.length === 0) + this.hide(); + } + }, + onRender: function() { // anonymous collection this.collectorView = new CollectorView({collection: new (Backbone.Collection.extend({ |