From 0b330dfcd605b063a88a1fe3863760ae5d08bcbc Mon Sep 17 00:00:00 2001 From: Alezia Kurdis <60075796+AleziaKurdis@users.noreply.github.com> Date: Thu, 28 May 2020 23:32:44 -0400 Subject: [PATCH] Zone selector sorting vs uppercases This makes the sorting of the Zone in the Zone selector with the uppercase grouped with the lowercase for a same letter but uppercase always first. (Note: Accented char are considered as a different letter. We would need to support exception cases for all the existing charsets. These are only entities descriptors, not really for literature.) --- scripts/system/create/edit.js | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/scripts/system/create/edit.js b/scripts/system/create/edit.js index 20927d9c3d..325a03937c 100644 --- a/scripts/system/create/edit.js +++ b/scripts/system/create/edit.js @@ -2905,21 +2905,24 @@ function getExistingZoneList() { }; listExistingZones.push(thisZone); } - listExistingZones.sort(zoneSortOrder()); + listExistingZones.sort(zoneSortOrder); return listExistingZones; } -function zoneSortOrder() { - return function(a, b) { - var nameA = a.name.toUpperCase(); - var nameB = b.name.toUpperCase(); - if (nameA > nameB) { - return 1; - } else if (nameA < nameB) { - return -1; - } - return 0; +function zoneSortOrder(a, b) { + var nameA = a.name.toUpperCase(); + var nameB = b.name.toUpperCase(); + if (nameA > nameB) { + return 1; + } else if (nameA < nameB) { + return -1; } + if (a.name > b.name) { + return 1; + } else if (a.name < b.name) { + return -1; + } + return 0; } }()); // END LOCAL_SCOPE