Updated site topic breadcrumbs
authorThierry Florac <thierry.florac@onf.fr>
Mon, 07 Jan 2019 10:08:38 +0100
changeset 343 9585f4db1024
parent 342 7ffaedd8d634
child 344 6dd56503f72f
Updated site topic breadcrumbs
src/pyams_default_theme/shared/site/__init__.py
--- a/src/pyams_default_theme/shared/site/__init__.py	Mon Jan 07 10:05:54 2019 +0100
+++ b/src/pyams_default_theme/shared/site/__init__.py	Mon Jan 07 10:08:38 2019 +0100
@@ -16,9 +16,11 @@
 
 from pyams_content.shared.site import IWfSiteTopic
 from pyams_content.shared.site.interfaces import ISiteFolder, ISiteManager, ISiteContainer
+from pyams_default_theme.viewlet.breadcrumb import BreadcrumbsAdapter
 from pyams_i18n.interfaces import II18n
 from pyams_sequence.interfaces import ISequentialIdInfo
 from pyams_skin.interfaces.metas import IHTMLContentMetas
+from pyams_skin.interfaces.viewlet import IBreadcrumbs
 from pyams_skin.layer import IPyAMSUserLayer
 from pyams_skin.metas import ContentMeta, HTMLTagMeta
 from pyams_utils.adapter import ContextRequestViewAdapter, adapter_config, ContextRequestAdapter
@@ -57,3 +59,13 @@
                                 self.context.content_url,
                                 '/{}'.format(view_name) if view_name else '.html',
                                 '?{}'.format(query) if query else ''))
+
+
+@adapter_config(context=(IWfSiteTopic, IPyAMSUserLayer, Interface), provides=IBreadcrumbs)
+class SiteTopicBreadcrumbsAdapter(BreadcrumbsAdapter):
+    """Site topic breadcrumbs adapter"""
+
+    @property
+    def items(self):
+        parent = self.context.__parent__
+        yield from self.get_items(parent)