aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files/js
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2014-07-22 10:11:00 +0200
committerVincent Petry <pvince81@owncloud.com>2014-07-22 10:11:00 +0200
commit5565eabb8170cf5ad5c0e38ea2014371d8de4ba5 (patch)
treefb187ebb0ebc85c9ce1e4cba37dfbc73aa5626a1 /apps/files/js
parent5696a88fc3e2f19cb0682152495a13f561e5f813 (diff)
parent319caa708928dcb77031dd96f997fbb9b5f3bf44 (diff)
downloadnextcloud-server-5565eabb8170cf5ad5c0e38ea2014371d8de4ba5.tar.gz
nextcloud-server-5565eabb8170cf5ad5c0e38ea2014371d8de4ba5.zip
Merge pull request #9683 from owncloud/fix_#8819_sorting
Fix #8819 sorting
Diffstat (limited to 'apps/files/js')
-rw-r--r--apps/files/js/filelist.js22
1 files changed, 18 insertions, 4 deletions
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js
index 61e73b7bebc..4ff7d0c3fa0 100644
--- a/apps/files/js/filelist.js
+++ b/apps/files/js/filelist.js
@@ -18,8 +18,8 @@
this.initialize($el, options);
};
FileList.prototype = {
- SORT_INDICATOR_ASC_CLASS: 'icon-triangle-s',
- SORT_INDICATOR_DESC_CLASS: 'icon-triangle-n',
+ SORT_INDICATOR_ASC_CLASS: 'icon-triangle-n',
+ SORT_INDICATOR_DESC_CLASS: 'icon-triangle-s',
id: 'files',
appName: t('files', 'Files'),
@@ -371,7 +371,12 @@
this.setSort(sort, (this._sortDirection === 'desc')?'asc':'desc');
}
else {
- this.setSort(sort, 'asc');
+ if ( sort === 'name' ) { //default sorting of name is opposite to size and mtime
+ this.setSort(sort, 'asc');
+ }
+ else {
+ this.setSort(sort, 'desc');
+ }
}
this.reload();
}
@@ -914,16 +919,25 @@
this._sort = sort;
this._sortDirection = (direction === 'desc')?'desc':'asc';
this._sortComparator = comparator;
+
if (direction === 'desc') {
this._sortComparator = function(fileInfo1, fileInfo2) {
return -comparator(fileInfo1, fileInfo2);
};
}
this.$el.find('thead th .sort-indicator')
- .removeClass(this.SORT_INDICATOR_ASC_CLASS + ' ' + this.SORT_INDICATOR_DESC_CLASS);
+ .removeClass(this.SORT_INDICATOR_ASC_CLASS)
+ .removeClass(this.SORT_INDICATOR_DESC_CLASS)
+ .toggleClass('hidden', true)
+ .addClass(this.SORT_INDICATOR_DESC_CLASS);
+
this.$el.find('thead th.column-' + sort + ' .sort-indicator')
+ .removeClass(this.SORT_INDICATOR_ASC_CLASS)
+ .removeClass(this.SORT_INDICATOR_DESC_CLASS)
+ .toggleClass('hidden', false)
.addClass(direction === 'desc' ? this.SORT_INDICATOR_DESC_CLASS : this.SORT_INDICATOR_ASC_CLASS);
},
+
/**
* Reloads the file list using ajax call
*