diff options
Diffstat (limited to 'pyload/web/app/scripts/views/dashboard')
-rw-r--r-- | pyload/web/app/scripts/views/dashboard/dashboardView.js | 11 | ||||
-rw-r--r-- | pyload/web/app/scripts/views/dashboard/packageView.js | 5 |
2 files changed, 12 insertions, 4 deletions
diff --git a/pyload/web/app/scripts/views/dashboard/dashboardView.js b/pyload/web/app/scripts/views/dashboard/dashboardView.js index d98e28fe3..6a263bf03 100644 --- a/pyload/web/app/scripts/views/dashboard/dashboardView.js +++ b/pyload/web/app/scripts/views/dashboard/dashboardView.js @@ -28,10 +28,8 @@ define(['jquery', 'backbone', 'underscore', 'app', 'models/TreeCollection', 'col var self = this; // When package is added we reload the data - this.listenTo(App.vent, 'package:added', function() { - console.log('Package tree caught, package:added event'); - self.tree.fetch(); - }); + this.listenTo(App.vent, 'package:added', _.bind(this.fetch, this)); + this.listenTo(App.vent, 'package:inserted', _.bind(this.fetch, this)); this.listenTo(App.vent, 'file:updated', _.bind(this.fileUpdated, this)); @@ -59,6 +57,11 @@ define(['jquery', 'backbone', 'underscore', 'app', 'models/TreeCollection', 'col this.$('.input').select2({tags: ['a', 'b', 'sdf']}); }, + fetch: function() { + console.log('Fetching package tree'); + this.tree.fetch(); + }, + update: function() { console.log('Update package list'); diff --git a/pyload/web/app/scripts/views/dashboard/packageView.js b/pyload/web/app/scripts/views/dashboard/packageView.js index 1bb250f27..243ebac9b 100644 --- a/pyload/web/app/scripts/views/dashboard/packageView.js +++ b/pyload/web/app/scripts/views/dashboard/packageView.js @@ -11,6 +11,7 @@ define(['jquery', 'app', 'views/abstract/itemView', 'underscore', 'hbs!tpl/dashb events: { 'click .package-name, .btn-open': 'open', 'click .icon-refresh': 'restart', + 'click .toggle-paused': 'pause', 'click .select': 'select', 'click .icon-chevron-down': 'loadMenu', 'click .btn-delete': 'deleteItem', @@ -68,6 +69,10 @@ define(['jquery', 'app', 'views/abstract/itemView', 'underscore', 'hbs!tpl/dashb App.dashboard.openPackage(this.model); }, + pause: function(e) { + this.model.togglePaused(); + }, + select: function(e) { e.preventDefault(); var checked = this.$('.select').hasClass('icon-check'); |