diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2012-12-23 16:00:31 +0100 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2012-12-23 16:00:31 +0100 |
commit | 90214a384adddbaa8c343b464d478d1518b37ad1 (patch) | |
tree | f888711d34486c9cb552a710ce1d0439c2e1af4b /module/web/static/js/models/TreeCollection.js | |
parent | added app object + event aggegator (diff) | |
download | pyload-90214a384adddbaa8c343b464d478d1518b37ad1.tar.xz |
cleaned the settings page
Diffstat (limited to 'module/web/static/js/models/TreeCollection.js')
-rw-r--r-- | module/web/static/js/models/TreeCollection.js | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/module/web/static/js/models/TreeCollection.js b/module/web/static/js/models/TreeCollection.js index 6476ea7b5..27d2cefce 100644 --- a/module/web/static/js/models/TreeCollection.js +++ b/module/web/static/js/models/TreeCollection.js @@ -26,11 +26,20 @@ define(['jquery', 'backbone', 'underscore', 'models/Package', 'collections/FileL return Backbone.Model.prototype.fetch.call(this, options); }, + // Parse the response and updates the collections parse: function(resp, xhr) { + if (this.get('packages') === null) + this.set('packages', new PackageList(_.values(resp.packages))); + else + this.packages.update(_.values(resp.packages)); + + if (this.get('files') === null) + this.set('files', new FileList(_.values(resp.files))); + else + this.files.update(_.values(resp.files)); + return { - root: new Package(resp.root), - packages: new PackageList(_.values(resp.packages)), - files: new FileList(_.values(resp.files)) + root: new Package(resp.root) }; } |