summaryrefslogtreecommitdiffstats
path: root/module/web/static/js/views/selectionView.js
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2013-02-20 12:00:22 +0100
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2013-02-20 12:00:22 +0100
commit1e1b64539144006c59c7b705700fc7f34c7a26b1 (patch)
treeebae99f037953469d4437331763c0c38d41e9511 /module/web/static/js/views/selectionView.js
parentintegrated new package view (diff)
downloadpyload-1e1b64539144006c59c7b705700fc7f34c7a26b1.tar.xz
more animation for dashboard
Diffstat (limited to 'module/web/static/js/views/selectionView.js')
-rw-r--r--module/web/static/js/views/selectionView.js59
1 files changed, 55 insertions, 4 deletions
diff --git a/module/web/static/js/views/selectionView.js b/module/web/static/js/views/selectionView.js
index 5cb22b776..673753cba 100644
--- a/module/web/static/js/views/selectionView.js
+++ b/module/web/static/js/views/selectionView.js
@@ -6,6 +6,13 @@ define(['jquery', 'backbone', 'underscore', 'app'],
el: '#selection-area',
template: _.compile($("#template-select").html()),
+ events: {
+ 'click .iconf-check': 'deselect',
+ 'click .iconf-pause': 'pause',
+ 'click .iconf-trash': 'trash',
+ 'click .iconf-refresh': 'refresh'
+ },
+
// available packages
tree: null,
// selected files
@@ -20,14 +27,26 @@ define(['jquery', 'backbone', 'underscore', 'app'],
App.vent.on('dashboard:show', _.bind(this.set_files, this));
App.vent.on('package:selection', _.bind(this.render, this));
App.vent.on('file:selection', _.bind(this.render, this));
+
+ // TODO
+// this.tree.get('packages').on('delete', _.bind(this.render, this));
},
- render: function() {
- var files = 0;
+ get_files: function() {
+ var files = [];
if (this.files)
- files = this.files.where({selected: true}).length;
+ files = this.files.where({selected: true});
+
+ return files;
+ },
- var packs = this.tree.get('packages').where({selected: true}).length;
+ get_packs: function() {
+ return this.tree.get('packages').where({selected: true});
+ },
+
+ render: function() {
+ var files = this.get_files().length;
+ var packs = this.get_packs().length;
if (files + packs > 0)
this.$el.html(this.template({files: files, packs: packs}));
@@ -44,6 +63,38 @@ define(['jquery', 'backbone', 'underscore', 'app'],
set_files: function(files) {
this.files = files;
this.render();
+ },
+
+ deselect: function() {
+ this.get_files().map(function(file) {
+ file.set('selected', false);
+ });
+
+ this.get_packs().map(function(pack) {
+ pack.set('selected', false);
+ });
+
+ this.render();
+ },
+
+ pause: function() {
+ // TODO
+ },
+
+ trash: function() {
+ this.get_files().map(function(file) {
+ file.destroy();
+ });
+
+ this.get_packs().map(function(pack) {
+ pack.destroy();
+ });
+
+ this.render();
+ },
+
+ refresh: function() {
+ // TODO
}
});
}); \ No newline at end of file