Added shared content properties preview
authorThierry Florac <thierry.florac@onf.fr>
Thu, 15 Mar 2018 09:31:00 +0100
changeset 15 12e5bc30061a
parent 14 4e76f8f239c2
child 16 d2950d484bdf
Added shared content properties preview
src/pyams_default_theme/shared/common.py
src/pyams_default_theme/shared/templates/content-preview.pt
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_default_theme/shared/common.py	Thu Mar 15 09:31:00 2018 +0100
@@ -0,0 +1,37 @@
+#
+# Copyright (c) 2008-2015 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.features.renderer.interfaces import IContentRenderer
+from pyams_content.shared.common.interfaces import IWfSharedContent
+from pyams_default_theme.layer import IPyAMSDefaultLayer
+
+# import packages
+from pyams_content.features.renderer.zmi import BaseContentRenderer
+from pyams_template.template import template_config
+from pyams_utils.adapter import adapter_config
+
+
+@adapter_config(name='properties-preview', context=(IWfSharedContent, IPyAMSDefaultLayer),
+                provides=IContentRenderer)
+@template_config(template='templates/content-preview.pt', layer=IPyAMSDefaultLayer)
+class SharedContentRenderer(BaseContentRenderer):
+    """Shared content renderer"""
+
+    weight = 1
+
+    i18n_context_attrs = ('title', )
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_default_theme/shared/templates/content-preview.pt	Thu Mar 15 09:31:00 2018 +0100
@@ -0,0 +1,1 @@
+<h1 tal:content="view.title" />