From 22e3baed4bbb83cf94bc849ee2f55b439b67856f Mon Sep 17 00:00:00 2001 From: yflory Date: Thu, 19 Oct 2017 15:00:29 +0200 Subject: [PATCH] Fix sort issues in drive --- www/drive/inner.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/www/drive/inner.js b/www/drive/inner.js index 2c180edc9..2e163d45b 100644 --- a/www/drive/inner.js +++ b/www/drive/inner.js @@ -1592,10 +1592,11 @@ define([ ['cp-app-drive-element-title', 'cp-app-drive-element-type', 'cp-app-drive-element-atime', 'cp-app-drive-element-ctime'].some(function (c) { if ($span.hasClass(c)) { - if (value === c) { descValue = descValue ? false : true; } + var nValue = c.replace(/cp-app-drive-element-/, ''); + if (value === nValue) { descValue = descValue ? false : true; } else { // atime and ctime should be ordered in a desc order at the first click - value = c.replace(/cp-app-drive-element-/, ''); + value = nValue; descValue = value !== 'title'; } return true; @@ -1647,7 +1648,7 @@ define([ } var classSorted; if (APP.store[SORT_FILE_BY] === '') { classSorted = 'cp-app-drive-sort-filename'; } - else if (APP.store[SORT_FILE_BY]) { classSorted = APP.store[SORT_FILE_BY]; } + else if (APP.store[SORT_FILE_BY]) { classSorted = 'cp-app-drive-element-' + APP.store[SORT_FILE_BY]; } if (classSorted) { $list.find('.' + classSorted).addClass('cp-app-drive-sort-active').prepend($icon); }