mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-03 07:55:36 +00:00
[sort libs] fix for broken libraries
This commit is contained in:
@@ -836,14 +836,26 @@ define([
|
|||||||
var libs = options.libs;
|
var libs = options.libs;
|
||||||
|
|
||||||
switch(sort_mode) {
|
switch(sort_mode) {
|
||||||
case 'name_up':
|
case 'name_up': // name of a broken library is null
|
||||||
libs.comparator = function(a, b) {
|
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'));
|
var result = _this.compareTwoWord(a.get('name'), b.get('name'));
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
case 'name_down':
|
case 'name_down':
|
||||||
libs.comparator = function(a, b) {
|
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'));
|
var result = _this.compareTwoWord(a.get('name'), b.get('name'));
|
||||||
return -result;
|
return -result;
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user