Commit 88a2655e authored by asseldonk's avatar asseldonk
Browse files

filebrowser: fixed bug in select all button

parent 9b81529d
......@@ -18,7 +18,7 @@
<input type="checkbox" class="file-selection-checkbox"/></span></div>
<div class="icon"><span data-bind="icon"></span></div>
<div class="name"><span class="completename"><span data-bind="root" class="filename-root"></span><span data-bind="ext" class="filename-ext"></span></span></div>
<div class="edit-tools"><a href="#" class="edit-rename"><i class="glyphicon glyphicon-pencil"></i><span class="hidden-sm hidden-xs">Rename</span></a><a href="#" class="edit-download"><i class="glyphicon glyphicon-download"></i><span class="hidden-sm hidden-xs">Download</span></a>
<div class="edit-tools hidden-xs"><a href="#" class="edit-rename"><i class="glyphicon glyphicon-pencil"></i><span class="hidden-sm hidden-xs">Rename</span></a><a href="#" class="edit-download"><i class="glyphicon glyphicon-download"></i><span class="hidden-sm hidden-xs">Download</span></a>
<!-- a.edit-share(href="#")-->
<!-- i.glyphicon.glyphicon-link-->
<!-- span.hidden-sm.hidden-xs Share--><a href="#" class="edit-remove"><i class="glyphicon glyphicon-remove"></i><span class="hidden-sm hidden-xs">Remove</span></a>
......
......@@ -23,7 +23,7 @@
span.completename
span.filename-root(data-bind="root")
span.filename-ext(data-bind="ext")
.edit-tools
.edit-tools.hidden-xs
a.edit-rename(href="#")
i.glyphicon.glyphicon-pencil
span.hidden-sm.hidden-xs Rename
......@@ -42,4 +42,4 @@
.time.hidden-xs
span(data-bind="mtime")
.file-properties.options
.glyphicon.glyphicon-cog
.glyphicon.glyphicon-cog
\ No newline at end of file
......@@ -20,6 +20,7 @@ var FileBaseEvents = Class.extend({
}
// in event.data is the node (where the data is stored)
self.FileBase.selections.changeSelection($(event.data));
self.FileBase.selections.checkIfAllSelected();
});
this.nodeRightClickHold(node, data);
this.nodeClickDblClick(node, data);
......
......@@ -6,6 +6,12 @@ var FileBaseSelections = Class.extend({
},
unselectAll: function() {
// unselect select all boc
var selectAllBox = $(".select-all");
if (selectAllBox.is(":checked")) {
selectAllBox.removeAttr("checked");
}
// unselect nodes
$.each(this.entries, function(key, node) {
$(".file-selection-checkbox", node).removeAttr("checked");
$(node).removeAttr("selected");
......@@ -18,7 +24,6 @@ var FileBaseSelections = Class.extend({
},
selectAll: function() {
this.unselectAll();
var nodes = $(".file-node", this.FileBase.view.fileContentContainer);
for (var i = 0; i < nodes.length; i++) {
var node = $(nodes[i]);
......@@ -27,6 +32,10 @@ var FileBaseSelections = Class.extend({
},
unselect: function(path) {
// uncheck select-all box
var selectAllBox = $(".select-all");
selectAllBox.removeAttr("checked");
// unselect nodes
delete this.entries[path];
if ($.isEmptyObject(this.entries) && !vispa.device.hasTouch && this.FileBase.instance.getPreference(
"Open") == "double") {
......@@ -76,6 +85,27 @@ var FileBaseSelections = Class.extend({
}
},
checkIfAllSelected: function() {
var nodes = $(".file-node", this.FileBase.view.fileContentContainer);
var allSelected = true;
// check all nodes, if they are selected
for (var i = 0; i < nodes.length; i++) {
var node = $(nodes[i]);
var selectp = $(".file-selection-p", node);
var selectbox = $(":checkbox", selectp);
if (!selectbox.is(":checked")) {
allSelected = false;
}
}
if (allSelected == true) {
// set select all checkbox to checked
var selectAllBox = $(".select-all");
selectAllBox.attr("checked", true);
selectAllBox.prop("checked", true);
}
},
selectNextNode: function() {
this.selectArbitNode(1);
},
......
......@@ -5,8 +5,6 @@ var FileBaseView = Class.extend({
this.FileBase = FileBase;
this.instance = FileBase.instance;
this.fileContentContainer = null;
this.dropzone = null;
// this.filePathBar = null;
this.filterField = null;
this.masterNode = null;
this.previewBoxID = null;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment