Skip to content

Commit

Permalink
Merge pull request #1140 from NatLibFi/fix-hierarchy-sort-after-pr-1113
Browse files Browse the repository at this point in the history
Fix sorting of concepts in hierarchy that broke in PR 1133
  • Loading branch information
osma authored Mar 22, 2021
2 parents e213096 + 110bac8 commit c84dc97
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions resource/js/hierarchy.js
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ function getTreeConfiguration() {
var aNode = this.get_node(a);
var bNode = this.get_node(b);

// sort on notation if requested
// sort on notation if requested, and notations exist
if (window.showNotation) {
var aNotation = aNode.original.notation;
var bNotation = bNode.original.notation;
Expand All @@ -524,15 +524,15 @@ function getTreeConfiguration() {
else return -1;
}
else if (bNotation) return 1;
} else {
// no sorting on notation requested
// make sure the tree nodes with class 'domain' are sorted before the others
// aDomain/bDomain will be "0" if a/b has a domain class, else "1"
var aDomain = (aNode.original.a_attr['class'] == 'domain') ? "0" : "1";
var bDomain = (bNode.original.a_attr['class'] == 'domain') ? "0" : "1";
return naturalCompare(aDomain + " " + aNode.text.toLowerCase(),
bDomain + " " + bNode.text.toLowerCase());
}
// NOTE: if no notations found, fall back on label comparison below
}
// no sorting on notation requested, or notations don't exist
// make sure the tree nodes with class 'domain' are sorted before the others
// aDomain/bDomain will be "0" if a/b has a domain class, else "1"
var aDomain = (aNode.original.a_attr['class'] == 'domain') ? "0" : "1";
var bDomain = (bNode.original.a_attr['class'] == 'domain') ? "0" : "1";
return naturalCompare(aDomain + " " + aNode.text.toLowerCase(),
bDomain + " " + bNode.text.toLowerCase());
}
});
}
Expand Down

0 comments on commit c84dc97

Please sign in to comment.