1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-02 07:27:04 +00:00

[sort libs] fix for broken libraries

This commit is contained in:
llj
2016-10-25 18:21:48 +08:00
parent ee3d19ff73
commit 65405ad84f

View File

@@ -836,14 +836,26 @@ define([
var libs = options.libs;
switch(sort_mode) {
case 'name_up':
case 'name_up': // name of a broken library is null
libs.comparator = function(a, b) {
if (!a.get('name')) {
return 1;
}
if (!b.get('name')) {
return -1;
}
var result = _this.compareTwoWord(a.get('name'), b.get('name'));
return result;
};
break;
case 'name_down':
libs.comparator = function(a, b) {
if (!a.get('name')) {
return -1;
}
if (!b.get('name')) {
return 1;
}
var result = _this.compareTwoWord(a.get('name'), b.get('name'));
return -result;
};