summaryrefslogtreecommitdiffstats
path: root/module/web/static/js/views
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2012-08-31 23:25:26 +0200
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2012-08-31 23:25:26 +0200
commitcbd4f4b5375f89362733e10a9b98e5a74c2a5734 (patch)
tree056bb5af9aec5dee164d7f3055819ceb40e92a87 /module/web/static/js/views
parentFixed free space issue closed #676 (diff)
downloadpyload-cbd4f4b5375f89362733e10a9b98e5a74c2a5734.tar.xz
first js models/views
Diffstat (limited to 'module/web/static/js/views')
-rw-r--r--module/web/static/js/views/packageTreeView.js54
1 files changed, 54 insertions, 0 deletions
diff --git a/module/web/static/js/views/packageTreeView.js b/module/web/static/js/views/packageTreeView.js
new file mode 100644
index 000000000..79527b394
--- /dev/null
+++ b/module/web/static/js/views/packageTreeView.js
@@ -0,0 +1,54 @@
+define(['jquery', 'backbone', 'underscore', 'models/TreeCollection'], function($, Backbone, _, TreeCollection){
+
+ // Renders whole PackageView
+ return Backbone.View.extend({
+
+ el: '#content',
+
+ events: {
+
+ },
+
+ initialize: function() {
+ _.bindAll(this, 'render');
+
+ this.tree = new TreeCollection();
+
+ },
+
+ init: function() {
+ var self = this;
+ this.tree.fetch({success: function(){
+ self.render();
+ }});
+ },
+
+
+ render: function() {
+
+ var packs = this.tree.get('packages'),
+ files = this.tree.get('files'),
+ html = 'Root: ' + this.tree.get('root').get('name') + '<br>';
+
+ html += 'Packages: ' + packs.size();
+ html += '<br><ul>';
+
+ packs.each(function(pack){
+ html += '<li>'+ pack.get('pid') + pack.get('name') + '</li>';
+ });
+
+ html += '</ul><br> Files: ' + files.size() + '<br><ul>';
+ files.each(function(file){
+ html += '<li>'+ file.get('fid') + file.get('name') + '</li>';
+ });
+
+ html += '</ul>';
+
+
+ this.$el.html(html);
+
+ return this;
+ }
+
+ });
+}); \ No newline at end of file