From 10ac403fde87d7da9a9727e74932e209a80be3d8 Mon Sep 17 00:00:00 2001 From: MrTango Date: Mon, 2 May 2022 20:33:17 +0300 Subject: [PATCH 1/3] Allow overiding navigation_depth via request param in GlobalSectionsViewlet --- news/301.feature | 1 + plone/app/layout/viewlets/common.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 news/301.feature diff --git a/news/301.feature b/news/301.feature new file mode 100644 index 000000000..cabab2951 --- /dev/null +++ b/news/301.feature @@ -0,0 +1 @@ +Allow overiding navigation_depth via request param in GlobalSectionsViewlet [MrTango] \ No newline at end of file diff --git a/plone/app/layout/viewlets/common.py b/plone/app/layout/viewlets/common.py index 79fb687e9..280e24c2f 100644 --- a/plone/app/layout/viewlets/common.py +++ b/plone/app/layout/viewlets/common.py @@ -304,11 +304,12 @@ def navtree(self): settings = self.settings if not settings.generate_tabs: return ret + navigation_depth = int(self.request.get("navigation_depth") or settings.navigation_depth) query = { "path": { "query": self.navtree_path, - "depth": settings.navigation_depth, + "depth": navigation_depth, }, "portal_type": {"query": settings.displayed_types}, "Language": self.current_language, From e35361c990090d24d8c876186799ebe2ccb02652 Mon Sep 17 00:00:00 2001 From: MrTango Date: Tue, 3 May 2022 09:34:22 +0300 Subject: [PATCH 2/3] Add global_sections view to only render GlobalSectionsViewlet to be able to pull it via AJAX --- news/301.feature | 3 ++- plone/app/layout/navigation/sections.pt | 11 +++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 plone/app/layout/navigation/sections.pt diff --git a/news/301.feature b/news/301.feature index cabab2951..02150157e 100644 --- a/news/301.feature +++ b/news/301.feature @@ -1 +1,2 @@ -Allow overiding navigation_depth via request param in GlobalSectionsViewlet [MrTango] \ No newline at end of file +- Allow overiding navigation_depth via request parameter in GlobalSectionsViewlet [MrTango] +- Add global_sections view to only render GlobalSectionsViewlet to be able to pull it via AJAX [MrTango] \ No newline at end of file diff --git a/plone/app/layout/navigation/sections.pt b/plone/app/layout/navigation/sections.pt new file mode 100644 index 000000000..29668abe0 --- /dev/null +++ b/plone/app/layout/navigation/sections.pt @@ -0,0 +1,11 @@ + + +
+ + \ No newline at end of file From f5309b7e77224fd9036cd536d5c315aa188ba03f Mon Sep 17 00:00:00 2001 From: MrTango Date: Tue, 3 May 2022 09:38:22 +0300 Subject: [PATCH 3/3] fix spelling --- news/301.feature | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/news/301.feature b/news/301.feature index 02150157e..011a6fb0a 100644 --- a/news/301.feature +++ b/news/301.feature @@ -1,2 +1,2 @@ -- Allow overiding navigation_depth via request parameter in GlobalSectionsViewlet [MrTango] +- Allow overriding navigation_depth via request parameter in GlobalSectionsViewlet [MrTango] - Add global_sections view to only render GlobalSectionsViewlet to be able to pull it via AJAX [MrTango] \ No newline at end of file