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 | |
parent | added app object + event aggegator (diff) | |
download | pyload-90214a384adddbaa8c343b464d478d1518b37ad1.tar.xz |
cleaned the settings page
Diffstat (limited to 'module/web/static/js')
-rw-r--r-- | module/web/static/js/app.js | 1 | ||||
-rw-r--r-- | module/web/static/js/default.js | 8 | ||||
-rw-r--r-- | module/web/static/js/models/TreeCollection.js | 15 | ||||
-rw-r--r-- | module/web/static/js/views/fileView.js | 2 |
4 files changed, 18 insertions, 8 deletions
diff --git a/module/web/static/js/app.js b/module/web/static/js/app.js index e846f3e0a..52a181463 100644 --- a/module/web/static/js/app.js +++ b/module/web/static/js/app.js @@ -23,6 +23,7 @@ define([ _.extend(this, options); }; + // Add Global Helper functions _.extend(Application.prototype, Backbone.Events, { diff --git a/module/web/static/js/default.js b/module/web/static/js/default.js index c82ae3299..4436a85c1 100644 --- a/module/web/static/js/default.js +++ b/module/web/static/js/default.js @@ -2,14 +2,14 @@ define('default', ['jquery', 'app', 'views/headerView', 'views/packageTreeView'] function($, App, HeaderView, TreeView) { App.init = function() { - var view = new HeaderView(); - view.render(); + App.header = new HeaderView(); + App.header.render(); }; App.initPackageTree = function() { $(function() { - var view = new TreeView(); - view.init(); + App.treeView = new TreeView(); + App.treeView.init(); }); }; 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) }; } diff --git a/module/web/static/js/views/fileView.js b/module/web/static/js/views/fileView.js index b37d4aefa..f020a69d4 100644 --- a/module/web/static/js/views/fileView.js +++ b/module/web/static/js/views/fileView.js @@ -1,4 +1,4 @@ -define(['jquery', 'backbone', 'underscore'], function($, Backbone, _) { +define(['jquery', 'backbone', 'underscore', 'app'], function($, Backbone, _, App) { // Renders single file item return Backbone.View.extend({ |