Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow overiding navigation_depth via request param in GlobalSectionsViewlet #301

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions news/301.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- 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]
11 changes: 11 additions & 0 deletions plone/app/layout/navigation/sections.pt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<html xmlns="http://www.w3.org/1999/xhtml"
xml:lang="en"
xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal"
xmlns:i18n="http://xml.zope.org/namespaces/i18n"
lang="en"
i18n:domain="plone">
<body>
<div tal:replace="structure provider:plone.mainnavigation" />
</body>
</html>
3 changes: 2 additions & 1 deletion plone/app/layout/viewlets/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down