diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2012-09-18 17:59:50 +0200 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2012-09-18 17:59:50 +0200 |
commit | 6130a2377ca6754fee88773097ce220abef1aa47 (patch) | |
tree | 76bea0d76393100fcf393c164c96d34f286aba7a /module/web/static/js/models/TreeCollection.js | |
parent | Added DuckcryptInfo decrypter, smaller fixes (diff) | |
parent | dropdowns in navbar (diff) | |
download | pyload-6130a2377ca6754fee88773097ce220abef1aa47.tar.xz |
merged stable into default
Diffstat (limited to 'module/web/static/js/models/TreeCollection.js')
-rw-r--r-- | module/web/static/js/models/TreeCollection.js | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/module/web/static/js/models/TreeCollection.js b/module/web/static/js/models/TreeCollection.js new file mode 100644 index 000000000..6476ea7b5 --- /dev/null +++ b/module/web/static/js/models/TreeCollection.js @@ -0,0 +1,38 @@ +define(['jquery', 'backbone', 'underscore', 'models/Package', 'collections/FileList', 'collections/PackageList'], + function($, Backbone, _, Package, FileList, PackageList) { + + // TreeCollection + // A Model and not a collection, aggregates other collections + return Backbone.Model.extend({ + + defaults : { + root: null, + packages: null, + files: null + }, + + initialize: function() { + + }, + + fetch: function(options) { + options || (options = {}); + var pid = options.pid || -1; + + // TODO: more options possible + options.url = 'api/getFileTree/' + pid + '/false'; + options.type = "post"; + + return Backbone.Model.prototype.fetch.call(this, options); + }, + + parse: function(resp, xhr) { + return { + root: new Package(resp.root), + packages: new PackageList(_.values(resp.packages)), + files: new FileList(_.values(resp.files)) + }; + } + + }); +});
\ No newline at end of file |