summaryrefslogtreecommitdiffstats
path: root/module/web/static/js/views/dashboardView.js
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2013-03-12 12:49:42 +0100
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2013-03-12 12:49:42 +0100
commit6232db5a1d3b8b5e4412af67d5bc7ca65f94333c (patch)
tree02a95e1216ace355d84a9704fb9070bd744b17c2 /module/web/static/js/views/dashboardView.js
parentadded missing file (diff)
downloadpyload-6232db5a1d3b8b5e4412af67d5bc7ca65f94333c.tar.xz
renamed most events, push events to webui
Diffstat (limited to 'module/web/static/js/views/dashboardView.js')
-rw-r--r--module/web/static/js/views/dashboardView.js19
1 files changed, 17 insertions, 2 deletions
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