summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2015-09-29 13:24:33 +0200
committerVincent Petry <pvince81@owncloud.com>2015-09-29 13:24:33 +0200
commitd52361b09b3960d962f59b03a7aa178b45efa5b1 (patch)
treece1433f231906dceda3c881dd5f6acdcca93c838
parent4eb299a308fa7501d3106c2857539bfc51bf5509 (diff)
downloadnextcloud-server-d52361b09b3960d962f59b03a7aa178b45efa5b1.tar.gz
nextcloud-server-d52361b09b3960d962f59b03a7aa178b45efa5b1.zip
Disable sorting when multiselect is enabled in file list
-rw-r--r--apps/files/css/files.css3
-rw-r--r--apps/files/js/filelist.js3
-rw-r--r--apps/files/tests/js/filelistSpec.js19
3 files changed, 25 insertions, 0 deletions
diff --git a/apps/files/css/files.css b/apps/files/css/files.css
index 5b1cd48fd49..d5ac9233239 100644
--- a/apps/files/css/files.css
+++ b/apps/files/css/files.css
@@ -190,6 +190,9 @@ table th .sort-indicator {
.multiselect .sort-indicator {
visibility: hidden;
}
+.multiselect .sort, .multiselect .sort span {
+ cursor: default;
+}
table th:hover .sort-indicator.hidden,
table th:focus .sort-indicator.hidden {
visibility: visible;
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js
index 4b1b38d783c..060269c220f 100644
--- a/apps/files/js/filelist.js
+++ b/apps/files/js/filelist.js
@@ -623,6 +623,9 @@
* Event handler when clicking on a table header
*/
_onClickHeader: function(e) {
+ if (this.$table.hasClass('multiselect')) {
+ return;
+ }
var $target = $(e.target);
var sort;
if (!$target.is('a')) {
diff --git a/apps/files/tests/js/filelistSpec.js b/apps/files/tests/js/filelistSpec.js
index c05e7c37214..31e5c410270 100644
--- a/apps/files/tests/js/filelistSpec.js
+++ b/apps/files/tests/js/filelistSpec.js
@@ -2156,6 +2156,25 @@ describe('OCA.Files.FileList tests', function() {
expect(fileList.files.length).toEqual(5);
expect(fileList.$fileList.find('tr').length).toEqual(5);
});
+ it('does not sort when clicking on header whenever multiselect is enabled', function() {
+ var sortStub = sinon.stub(OCA.Files.FileList.prototype, 'setSort');
+
+ fileList.setFiles(testFiles);
+ fileList.findFileEl('One.txt').find('input:checkbox:first').click();
+
+ fileList.$el.find('.column-size .columntitle').click();
+
+ expect(sortStub.notCalled).toEqual(true);
+
+ // can sort again after deselecting
+ fileList.findFileEl('One.txt').find('input:checkbox:first').click();
+
+ fileList.$el.find('.column-size .columntitle').click();
+
+ expect(sortStub.calledOnce).toEqual(true);
+
+ sortStub.restore();
+ });
});
describe('create file', function() {
var deferredCreate;