aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files
diff options
context:
space:
mode:
authorJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2019-04-30 12:26:37 +0200
committerJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2019-04-30 16:53:50 +0200
commit54afe0bca27e5cb95d05e043d2e40cea4c72575b (patch)
treed67af65ce9226a475eb12806627f75f4226f3521 /apps/files
parent4fd2cbeb94faea75d9d14be3939a7d6bce2d88cf (diff)
downloadnextcloud-server-54afe0bca27e5cb95d05e043d2e40cea4c72575b.tar.gz
nextcloud-server-54afe0bca27e5cb95d05e043d2e40cea4c72575b.zip
Do NOT assume all files are selected if the first checkbox is
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'apps/files')
-rw-r--r--apps/files/js/filelist.js24
1 files changed, 18 insertions, 6 deletions
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js
index 44c4c5abec9..ea4ea6e1956 100644
--- a/apps/files/js/filelist.js
+++ b/apps/files/js/filelist.js
@@ -897,7 +897,16 @@
* Event handler for when selecting/deselecting all files
*/
_onClickSelectAll: function(e) {
- var checked = $(e.target).prop('checked');
+ var hiddenFiles = this.$fileList.find('tr.hidden');
+ var checked = e.target.checked;
+
+ if (hiddenFiles.length > 0) {
+ // set indeterminate alongside checked
+ e.target.indeterminate = checked;
+ } else {
+ e.target.indeterminate = false
+ }
+
// Select only visible checkboxes to filter out unmatched file in search
this.$fileList.find('td.selection > .selectCheckBox:visible').prop('checked', checked)
.closest('tr').toggleClass('selected', checked);
@@ -907,7 +916,7 @@
// a search will automatically hide the unwanted rows
// let's only select the matches
var fileData = this.files[i];
- var fileRow = this.$fileList.find('[data-id=' + fileData.id + ']');
+ var fileRow = this.$fileList.find('tr[data-id=' + fileData.id + ']');
// do not select already selected ones
if (!fileRow.hasClass('hidden') && _.isUndefined(this._selectedFiles[fileData.id])) {
this._selectedFiles[fileData.id] = fileData;
@@ -917,7 +926,6 @@
} else {
// if we have some hidden row, then we're in a search
// Let's only deselect the visible ones
- var hiddenFiles = this.$fileList.find('tr.hidden');
if (hiddenFiles.length > 0) {
var visibleFiles = this.$fileList.find('tr:not(.hidden)');
var self = this;
@@ -3260,11 +3268,15 @@
},
/**
- * Returns whether all files are selected
- * @return true if all files are selected, false otherwise
+ * Are all files selected?
+ *
+ * @returns {Boolean} all files are selected
*/
isAllSelected: function() {
- return this.$el.find('.select-all').prop('checked');
+ var checkbox = this.$el.find('.select-all')
+ var checked = checkbox.prop('checked')
+ var indeterminate = checkbox.prop('indeterminate')
+ return checked && !indeterminate;
},
/**