From 6232db5a1d3b8b5e4412af67d5bc7ca65f94333c Mon Sep 17 00:00:00 2001 From: RaNaN Date: Tue, 12 Mar 2013 12:49:42 +0100 Subject: renamed most events, push events to webui --- module/web/static/js/views/dashboardView.js | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'module/web/static/js/views/dashboardView.js') diff --git a/module/web/static/js/views/dashboardView.js b/module/web/static/js/views/dashboardView.js index d9ff1c5fc..58a50777c 100644 --- a/module/web/static/js/views/dashboardView.js +++ b/module/web/static/js/views/dashboardView.js @@ -35,7 +35,11 @@ define(['jquery', 'backbone', 'underscore', 'app', 'models/TreeCollection', self.tree.fetch(); }); - // TODO file:added + App.vent.on('file:updated', _.bind(this.fileUpdated, this)); + + // TODO: file:added + // TODO: package:deleted + // TODO: package:updated }, init: function() { @@ -48,7 +52,7 @@ define(['jquery', 'backbone', 'underscore', 'app', 'models/TreeCollection', self.tree.get('packages').on('add', function(pack) { console.log('Package ' + pack.get('pid') + ' added to tree'); self.appendPackage(pack, 0, true); - + self.openPackage(pack); }); }}); @@ -144,6 +148,17 @@ define(['jquery', 'backbone', 'underscore', 'app', 'models/TreeCollection', //TODO: show placeholder when nothing is displayed (filtered content empty) this.fileUL.fadeIn(); App.vent.trigger('dashboard:updated'); + }, + + // Refresh the file if it is currently shown + fileUpdated: function(data) { + // this works with ids and object + var file = this.files.get(data); + if (file) + if (_.isObject(data)) // update directly + file.set(data); + else // fetch from server + file.fetch(); } }); }); \ No newline at end of file -- cgit v1.2.3