Added default front-office breadcrumb adapter
authorThierry Florac <tflorac@ulthar.net>
Wed, 12 Sep 2018 16:40:52 +0200
changeset 943 81a89382c18a
parent 942 d2d7b253cd59
child 944 57841e1c4fa1
Added default front-office breadcrumb adapter
src/pyams_content/shared/site/skin/__init__.py
src/pyams_content/shared/site/skin/breadcrumb.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_content/shared/site/skin/__init__.py	Wed Sep 12 16:40:52 2018 +0200
@@ -0,0 +1,20 @@
+#
+# Copyright (c) 2008-2018 Thierry Florac <tflorac AT ulthar.net>
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+
+__docformat__ = 'restructuredtext'
+
+
+# import standard library
+
+# import interfaces
+
+# import packages
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_content/shared/site/skin/breadcrumb.py	Wed Sep 12 16:40:52 2018 +0200
@@ -0,0 +1,35 @@
+#
+# Copyright (c) 2008-2018 Thierry Florac <tflorac AT ulthar.net>
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+
+__docformat__ = 'restructuredtext'
+
+
+# import standard library
+
+# import interfaces
+from pyams_content.shared.site.interfaces import ISiteContainer
+from pyams_i18n.interfaces import II18n
+from pyams_skin.interfaces.viewlet import IBreadcrumbItem
+from pyams_skin.layer import IPyAMSUserLayer
+
+# import packages
+from pyams_skin.viewlet.breadcrumb import BreadcrumbItem
+from pyams_utils.adapter import adapter_config
+
+
+@adapter_config(context=(ISiteContainer, IPyAMSUserLayer), provides=IBreadcrumbItem)
+class SiteContainerBreadcumbAdapter(BreadcrumbItem):
+    """Site container breadcrumb adapter"""
+
+    @property
+    def label(self):
+        return II18n(self.context).query_attribute('short_name', request=self.request)