summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorryanwr <ryantwr@gmail.com>2016-10-22 21:26:21 +0100
committerryanwr <ryantwr@gmail.com>2016-10-24 17:55:47 +0100
commit3e96f33995c522106b645908b4537b25536b8a7d (patch)
treec39d09a2e2ddfdc32e0bdba2fffa449055692f38 /apps
parent9965a95e3b9aff118fa7a34102e5ac31367ac7e2 (diff)
downloadnextcloud-server-3e96f33995c522106b645908b4537b25536b8a7d.tar.gz
nextcloud-server-3e96f33995c522106b645908b4537b25536b8a7d.zip
Sort favorite files first Issue #1802
Signed-off-by: Ryan Welch <ryantwr@gmail.com>
Diffstat (limited to 'apps')
-rw-r--r--apps/files/js/filelist.js14
1 files changed, 8 insertions, 6 deletions
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js
index 159d008e6e6..53ad8eafeef 100644
--- a/apps/files/js/filelist.js
+++ b/apps/files/js/filelist.js
@@ -1500,13 +1500,15 @@
var comparator = FileList.Comparators[sort] || FileList.Comparators.name;
this._sort = sort;
this._sortDirection = (direction === 'desc')?'desc':'asc';
- this._sortComparator = comparator;
+ this._sortComparator = function(fileInfo1, fileInfo2) {
+ if(fileInfo1.isFavorite && !fileInfo2.isFavorite) {
+ return -1;
+ } else if(!fileInfo1.isFavorite && fileInfo2.isFavorite) {
+ return 1;
+ }
+ return direction === 'asc' ? comparator(fileInfo1, fileInfo2) : -comparator(fileInfo1, fileInfo2);
+ };
- 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)
.removeClass(this.SORT_INDICATOR_DESC_CLASS)