From 66d5aa353b78562a185d88d412837f30786d44df Mon Sep 17 00:00:00 2001 From: Wiemboudabous Date: Mon, 13 Jan 2025 10:52:28 +0100 Subject: [PATCH 1/3] sort list of vocabulary folders by title --- src/Products/urban/browser/urbanconfigview.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Products/urban/browser/urbanconfigview.py b/src/Products/urban/browser/urbanconfigview.py index 221ffeae5..ec9fda353 100644 --- a/src/Products/urban/browser/urbanconfigview.py +++ b/src/Products/urban/browser/urbanconfigview.py @@ -72,7 +72,10 @@ def getVocabularyFolders(self): for folder in context.objectValues("ATFolder") if folder not in other_folders ] - return folders + # Sort folders by their title attribute + sorted_folders = sorted(folders, key=lambda folder: folder.Title()) + + return sorted_folders def getScheduleConfigs(self): context = aq_inner(self.context) From de4630005b216ce3163f4a2aa485b2ce2c90e9e0 Mon Sep 17 00:00:00 2001 From: Wiemboudabous Date: Tue, 14 Jan 2025 14:33:55 +0100 Subject: [PATCH 2/3] add sorting to folder managers by title in the query --- src/Products/urban/content/licence/GenericLicence.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Products/urban/content/licence/GenericLicence.py b/src/Products/urban/content/licence/GenericLicence.py index 1882e8ff8..88a1bea47 100755 --- a/src/Products/urban/content/licence/GenericLicence.py +++ b/src/Products/urban/content/licence/GenericLicence.py @@ -1544,6 +1544,8 @@ def foldermanagersBaseQuery(self): dict = {} dict["path"] = {"query": "%s/portal_urban/foldermanagers" % (rootPath)} dict["id"] = ids + # add sort_on to sort the results of folder managers by the 'sortable_title' field + dict["sort_on"] = "sortable_title" return dict security.declarePublic("getParcels") From eb0f4b715b3741546209200cc0c16ff3cc98fcdf Mon Sep 17 00:00:00 2001 From: Wiemboudabous Date: Wed, 15 Jan 2025 15:34:52 +0100 Subject: [PATCH 3/3] remove uppercase duplicates in nottary letter --- src/Products/urban/LicenceConfig.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Products/urban/LicenceConfig.py b/src/Products/urban/LicenceConfig.py index 973e869df..3f6abddab 100644 --- a/src/Products/urban/LicenceConfig.py +++ b/src/Products/urban/LicenceConfig.py @@ -339,6 +339,11 @@ def listUsedAttributes(self): ), ) ) + # Remove duplicates based on lowercase text while prioritizing lowercase entries + res = list({ + field_label.lower(): (field_name, field_label) + for field_name, field_label in sorted(res, key=lambda x: x[1].islower(), reverse=True) + }.values()) return DisplayList(tuple(res)).sortedByValue() def listLicenceConfigs(self):