summaryrefslogtreecommitdiffstats
path: root/module/web/static/js/views/selectionView.js
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2013-02-27 14:02:03 +0100
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2013-02-27 14:02:03 +0100
commit1da5d741272de374bd11d4224be347bc6aa45053 (patch)
tree3498d4acb2d47e9a56a05a5f6333d639b4e74a3b /module/web/static/js/views/selectionView.js
parentupdated js libraries, cleaned jquery-ui (diff)
downloadpyload-1da5d741272de374bd11d4224be347bc6aa45053.tar.xz
prepared dashboard actionbar
Diffstat (limited to 'module/web/static/js/views/selectionView.js')
-rw-r--r--module/web/static/js/views/selectionView.js33
1 files changed, 30 insertions, 3 deletions
diff --git a/module/web/static/js/views/selectionView.js b/module/web/static/js/views/selectionView.js
index 6d346b6ee..4c433e31c 100644
--- a/module/web/static/js/views/selectionView.js
+++ b/module/web/static/js/views/selectionView.js
@@ -17,6 +17,8 @@ define(['jquery', 'backbone', 'underscore', 'app'],
tree: null,
// selected files
files: null,
+ // Element of the action bar
+ actionBar: null,
// needed to know when slide down
current: 0,
@@ -28,7 +30,10 @@ define(['jquery', 'backbone', 'underscore', 'app'],
App.vent.on('package:selection', _.bind(this.render, this));
App.vent.on('file:selection', _.bind(this.render, this));
- // TODO
+ this.actionBar = $('.actionbar .btn-check');
+ this.actionBar.parent().click(_.bind(this.select_toggle, this));
+
+ // TODO when something gets deleted
// this.tree.get('packages').on('delete', _.bind(this.render, this));
},
@@ -58,8 +63,12 @@ define(['jquery', 'backbone', 'underscore', 'app'],
else if (files + packs === 0 && this.current > 0)
this.$el.slideIn();
- this.current = files + packs;
+ if (files > 0)
+ this.actionBar.addClass('iconf-check').removeClass('iconf-check-empty');
+ else
+ this.actionBar.addClass('iconf-check-empty').removeClass('iconf-check');
+ this.current = files + packs;
},
set_files: function(files) {
@@ -67,7 +76,8 @@ define(['jquery', 'backbone', 'underscore', 'app'],
this.render();
},
- deselect: function() {
+ // Deselects all items, optional only files
+ deselect: function(filesOnly) {
this.get_files().map(function(file) {
file.set('selected', false);
});
@@ -107,6 +117,23 @@ define(['jquery', 'backbone', 'underscore', 'app'],
});
this.deselect();
+ },
+
+ // Select or deselect all visible files
+ select_toggle: function() {
+ var files = this.get_files();
+ if (files.length === 0) {
+ // TODO Select only visible files
+ this.files.map(function(file) {
+ file.set('selected', true);
+ });
+
+ } else
+ files.map(function(file) {
+ file.set('selected', false);
+ });
+
+ this.render();
}
});
}); \ No newline at end of file