From 90214a384adddbaa8c343b464d478d1518b37ad1 Mon Sep 17 00:00:00 2001 From: RaNaN Date: Sun, 23 Dec 2012 16:00:31 +0100 Subject: cleaned the settings page --- module/web/static/js/models/TreeCollection.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'module/web/static/js/models/TreeCollection.js') 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) }; } -- cgit v1.2.3