Fix sort issues in drive

pull/1/head
yflory 7 years ago
parent f43606f71d
commit 22e3baed4b

@ -1592,10 +1592,11 @@ define([
['cp-app-drive-element-title', 'cp-app-drive-element-type', ['cp-app-drive-element-title', 'cp-app-drive-element-type',
'cp-app-drive-element-atime', 'cp-app-drive-element-ctime'].some(function (c) { 'cp-app-drive-element-atime', 'cp-app-drive-element-ctime'].some(function (c) {
if ($span.hasClass(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 { else {
// atime and ctime should be ordered in a desc order at the first click // 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'; descValue = value !== 'title';
} }
return true; return true;
@ -1647,7 +1648,7 @@ define([
} }
var classSorted; var classSorted;
if (APP.store[SORT_FILE_BY] === '') { classSorted = 'cp-app-drive-sort-filename'; } 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) { if (classSorted) {
$list.find('.' + classSorted).addClass('cp-app-drive-sort-active').prepend($icon); $list.find('.' + classSorted).addClass('cp-app-drive-sort-active').prepend($icon);
} }

Loading…
Cancel
Save