1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-10-21 19:00:12 +00:00

[dir view] bugfix for 'sort by time'

This commit is contained in:
llj
2015-07-14 14:22:12 +08:00
parent b29974901c
commit 285f1a6e04

View File

@@ -458,7 +458,8 @@ define([
dirents.comparator = function(a, b) { dirents.comparator = function(a, b) {
if (a.get('is_dir') && b.get('is_file')) { if (a.get('is_dir') && b.get('is_file')) {
return -1; return -1;
} else if (a.get('is_file') && b.get('is_dir')) { }
if (a.get('is_file') && b.get('is_dir')) {
return 1; return 1;
} }
@@ -485,6 +486,9 @@ define([
if (a.get('is_dir') && b.get('is_file')) { if (a.get('is_dir') && b.get('is_file')) {
return -1; return -1;
} }
if (a.get('is_file') && b.get('is_dir')) {
return 1;
}
if (el.hasClass('icon-caret-down')) { if (el.hasClass('icon-caret-down')) {
return a.get('last_modified') < b.get('last_modified') ? 1 : -1; return a.get('last_modified') < b.get('last_modified') ? 1 : -1;
} else { } else {
@@ -492,6 +496,7 @@ define([
} }
}; };
dirents.sort(); dirents.sort();
this.$dirent_list.empty(); this.$dirent_list.empty();
dirents.each(this.addOne, this); dirents.each(this.addOne, this);
el.toggleClass('icon-caret-up icon-caret-down').show(); el.toggleClass('icon-caret-up icon-caret-down').show();