Added template for shared content renderer
authorThierry Florac <thierry.florac@onf.fr>
Mon, 27 Aug 2018 11:10:19 +0200
changeset 885 ff78277727b3
parent 884 e8f95dc29dd9
child 886 6e6f0ac2f317
Added template for shared content renderer
src/pyams_content/shared/common/portlet/content/skin/__init__.py
src/pyams_content/shared/common/portlet/content/skin/templates/content.pt
--- a/src/pyams_content/shared/common/portlet/content/skin/__init__.py	Mon Aug 27 10:59:37 2018 +0200
+++ b/src/pyams_content/shared/common/portlet/content/skin/__init__.py	Mon Aug 27 11:10:19 2018 +0200
@@ -12,6 +12,7 @@
 
 __docformat__ = 'restructuredtext'
 
+
 # import standard library
 
 # import interfaces
@@ -22,6 +23,7 @@
 
 # import packages
 from pyams_portal.portlet import PortletRenderer
+from pyams_template.template import template_config
 from pyams_utils.adapter import adapter_config
 from zope.interface import Interface
 
@@ -30,6 +32,7 @@
 
 @adapter_config(context=(IPortalContext, IPyAMSLayer, Interface, ISharedContentPortletSettings),
                 provides=IPortletRenderer)
+@template_config(template='templates/content.pt', layer=IPyAMSLayer)
 class SharedContentPortletRenderer(PortletRenderer):
     """Shared content portlet renderer"""
 
@@ -45,10 +48,3 @@
     def update(self):
         super(SharedContentPortletRenderer, self).update()
         [renderer.update() for renderer in self.renderers]
-
-    def render(self):
-        result = ''
-        for renderer in self.renderers:
-            if renderer is not None:
-                result += renderer.render()
-        return result
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_content/shared/common/portlet/content/skin/templates/content.pt	Mon Aug 27 11:10:19 2018 +0200
@@ -0,0 +1,7 @@
+<div class="edito"
+	 tal:condition="view.renderers">
+	<tal:loop repeat="renderer view.renderers">
+		<tal:if condition="renderer"
+				content="structure renderer.render()">Renderer</tal:if>
+	</tal:loop>
+</div>