diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2013-12-04 20:20:32 +0100 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2013-12-04 20:20:32 +0100 |
commit | 6d7aa32c3c710fdb58768e8f89c0e1ed608efdd0 (patch) | |
tree | dff6400e375fd8ad2086d8adc300c566ff2620f6 | |
parent | password field for linkgrabber (diff) | |
download | pyload-6d7aa32c3c710fdb58768e8f89c0e1ed608efdd0.tar.xz |
clear dashboard when opened package is deleted
-rw-r--r-- | pyload/web/app/scripts/views/dashboard/dashboardView.js | 8 | ||||
-rw-r--r-- | pyload/web/app/scripts/views/dashboard/packageView.js | 4 |
2 files changed, 9 insertions, 3 deletions
diff --git a/pyload/web/app/scripts/views/dashboard/dashboardView.js b/pyload/web/app/scripts/views/dashboard/dashboardView.js index 6a263bf03..fbf1055f5 100644 --- a/pyload/web/app/scripts/views/dashboard/dashboardView.js +++ b/pyload/web/app/scripts/views/dashboard/dashboardView.js @@ -30,6 +30,7 @@ define(['jquery', 'backbone', 'underscore', 'app', 'models/TreeCollection', 'col // When package is added we reload the data this.listenTo(App.vent, 'package:added', _.bind(this.fetch, this)); this.listenTo(App.vent, 'package:inserted', _.bind(this.fetch, this)); + this.listenTo(App.vent, 'package:destroyed', _.bind(this.packageDestroyed, this)); this.listenTo(App.vent, 'file:updated', _.bind(this.fileUpdated, this)); @@ -170,6 +171,13 @@ define(['jquery', 'backbone', 'underscore', 'app', 'models/TreeCollection', 'col App.vent.trigger('dashboard:updated'); }}); } + }, + + // destroys files when opened package is deleted + packageDestroyed: function(pack) { + // TODO: could be improved + if (pack.get('files') === this.files) + App.vent.trigger('dashboard:destroyContent') } }); });
\ No newline at end of file diff --git a/pyload/web/app/scripts/views/dashboard/packageView.js b/pyload/web/app/scripts/views/dashboard/packageView.js index 243ebac9b..382615212 100644 --- a/pyload/web/app/scripts/views/dashboard/packageView.js +++ b/pyload/web/app/scripts/views/dashboard/packageView.js @@ -53,9 +53,7 @@ define(['jquery', 'app', 'views/abstract/itemView', 'underscore', 'hbs!tpl/dashb unrender: function() { itemView.prototype.unrender.apply(this); - - // TODO: display other package - App.vent.trigger('dashboard:loading', null); + App.vent.trigger('package:destroyed', this.model); }, // TODO |