From ca476bad54d44f3854a03fa25cc0c94f3092efbb Mon Sep 17 00:00:00 2001 From: David Ichim Date: Wed, 20 Nov 2024 15:15:17 +0200 Subject: [PATCH 1/6] feat(contextnavigation): add file size info to context navigation items --- eea/volto/policy/restapi/services/contextnavigation/get.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/eea/volto/policy/restapi/services/contextnavigation/get.py b/eea/volto/policy/restapi/services/contextnavigation/get.py index 9f68835..c83516a 100644 --- a/eea/volto/policy/restapi/services/contextnavigation/get.py +++ b/eea/volto/policy/restapi/services/contextnavigation/get.py @@ -150,7 +150,6 @@ def render(self): state = "" else: state = api.content.get_state(root) - res["items"].append( { "@id": root.absolute_url(), @@ -185,11 +184,12 @@ def recurse(self, children, level, bottomLevel): for node in children: brain = node["item"] + is_file = node["portal_type"] == "File" icon = "" if show_icons: - if node["portal_type"] == "File": + if is_file: icon = self.getMimeTypeIcon(node) has_thumb = brain.getIcon @@ -204,6 +204,7 @@ def recurse(self, children, level, bottomLevel): item_remote_url = node["getRemoteUrl"] use_remote_url = node["useRemoteUrl"] item_url = node["getURL"] + item = { "@id": item_url, "description": node["Description"], @@ -218,6 +219,7 @@ def recurse(self, children, level, bottomLevel): "thumb": thumb, "title": node.get("side_nav_title", node["Title"]), "type": node["normalized_portal_type"], + "getObjSize": brain.getObjSize if is_file else "", } if node.get("nav_title", False): From 141a4b2c106b95ac2f9c995ef92ff59b2d2d2736 Mon Sep 17 00:00:00 2001 From: David Ichim Date: Thu, 21 Nov 2024 19:56:54 +0200 Subject: [PATCH 2/6] Fixed fallback from side_nav_title which was setting title to None for root item --- eea/volto/policy/restapi/services/contextnavigation/get.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/eea/volto/policy/restapi/services/contextnavigation/get.py b/eea/volto/policy/restapi/services/contextnavigation/get.py index c83516a..de5abea 100644 --- a/eea/volto/policy/restapi/services/contextnavigation/get.py +++ b/eea/volto/policy/restapi/services/contextnavigation/get.py @@ -163,7 +163,7 @@ def render(self): "normalized_id": normalized_id, "thumb": "", # set title to side_nav_title if available - "title": getattr(root, "side_nav_title", root_title), + "title": getattr(root, "side_nav_title", "") or root_title, "type": root_type, "review_state": state, } @@ -204,7 +204,6 @@ def recurse(self, children, level, bottomLevel): item_remote_url = node["getRemoteUrl"] use_remote_url = node["useRemoteUrl"] item_url = node["getURL"] - item = { "@id": item_url, "description": node["Description"], @@ -217,7 +216,7 @@ def recurse(self, children, level, bottomLevel): "normalized_id": node["normalized_id"], "review_state": node["review_state"] or "", "thumb": thumb, - "title": node.get("side_nav_title", node["Title"]), + "title": getattr(node, "side_nav_title", "") or node["Title"], "type": node["normalized_portal_type"], "getObjSize": brain.getObjSize if is_file else "", } From 05f633ae28c36b19289c5a379c507847c0765ebb Mon Sep 17 00:00:00 2001 From: EEA Jenkins <2368628+eea-jenkins@users.noreply.github.com> Date: Mon, 25 Nov 2024 12:23:38 +0200 Subject: [PATCH 3/6] Back to devel --- docs/HISTORY.txt | 3 +++ eea/volto/policy/version.txt | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/HISTORY.txt b/docs/HISTORY.txt index 0172069..7acd948 100644 --- a/docs/HISTORY.txt +++ b/docs/HISTORY.txt @@ -1,6 +1,9 @@ Changelog ========= +5.8-dev0 - (unreleased) +--------------------------- + 5.7 - (2024-11-24) --------------------------- * Change: Improve svg upgrade step to know which svgs are fixed and not revisit them diff --git a/eea/volto/policy/version.txt b/eea/volto/policy/version.txt index 760606e..00fbe3a 100644 --- a/eea/volto/policy/version.txt +++ b/eea/volto/policy/version.txt @@ -1 +1 @@ -5.7 +5.8-dev0 From dd91a732873cc26b87d2730d0d0b768b51de6563 Mon Sep 17 00:00:00 2001 From: Ichim David Date: Tue, 26 Nov 2024 19:19:23 +0200 Subject: [PATCH 4/6] Update HISTORY.txt --- docs/HISTORY.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/HISTORY.txt b/docs/HISTORY.txt index 7acd948..c0be0bf 100644 --- a/docs/HISTORY.txt +++ b/docs/HISTORY.txt @@ -3,6 +3,10 @@ Changelog 5.8-dev0 - (unreleased) --------------------------- +* Feature: added getObjSize info for File portal_type used to get file size information + [ichim-david - refs #280463] +* Bug fix: fixed title of the initial navigation item when `side_title_nav` isn't set + [ichim-david - refs #280463] 5.7 - (2024-11-24) --------------------------- From 797ace6f81c4e7450bf3409acbb8a92a33cc5859 Mon Sep 17 00:00:00 2001 From: EEA Jenkins Date: Tue, 26 Nov 2024 19:25:58 +0200 Subject: [PATCH 5/6] Updated version to 5.8 --- eea/volto/policy/version.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eea/volto/policy/version.txt b/eea/volto/policy/version.txt index 00fbe3a..3659ea2 100644 --- a/eea/volto/policy/version.txt +++ b/eea/volto/policy/version.txt @@ -1 +1 @@ -5.8-dev0 +5.8 From 8e3185567c99bcb477c980664612c2e6851e0457 Mon Sep 17 00:00:00 2001 From: EEA Jenkins Date: Tue, 26 Nov 2024 19:26:01 +0200 Subject: [PATCH 6/6] Updated changelog - removed develop information --- docs/HISTORY.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/HISTORY.txt b/docs/HISTORY.txt index c0be0bf..9fa47a5 100644 --- a/docs/HISTORY.txt +++ b/docs/HISTORY.txt @@ -1,7 +1,7 @@ Changelog ========= -5.8-dev0 - (unreleased) +5.8 - (2024-11-26) --------------------------- * Feature: added getObjSize info for File portal_type used to get file size information [ichim-david - refs #280463]