Added Keynumber portlet default renderer dev-dc
authorDamien Correia
Fri, 15 Jun 2018 18:02:10 +0200
branchdev-dc
changeset 51 67b8199301b8
parent 50 c14ccc1308ad
child 52 d80fc625e4d8
Added Keynumber portlet default renderer
src/pyams_default_theme/component/keynumber/__init__.py
src/pyams_default_theme/component/keynumber/portlet/__init__.py
src/pyams_default_theme/component/keynumber/portlet/templates/render.pt
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_default_theme/component/keynumber/__init__.py	Fri Jun 15 18:02:10 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_default_theme/component/keynumber/portlet/__init__.py	Fri Jun 15 18:02:10 2018 +0200
@@ -0,0 +1,36 @@
+#
+# 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.component.keynumber.portlet import IKeyNumberPortletSettings
+from pyams_portal.interfaces import IPortalContext, IPortletRenderer
+from pyams_portal.portlet import PortletRenderer
+from pyams_skin.layer import IPyAMSLayer
+
+# import packages
+from pyams_template.template import template_config
+from pyams_utils.adapter import adapter_config
+
+from zope.interface import Interface
+from pyams_default_theme import _
+
+
+@adapter_config(context=(IPortalContext, IPyAMSLayer, Interface, IKeyNumberPortletSettings), provides=IPortletRenderer)
+@template_config(template='templates/render.pt', layer=IPyAMSLayer)
+class KeyNumberPortletRenderer(PortletRenderer):
+    """New portlet renderer"""
+
+    label = _("Default comment renderer")
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_default_theme/component/keynumber/portlet/templates/render.pt	Fri Jun 15 18:02:10 2018 +0200
@@ -0,0 +1,19 @@
+<div tal:define="settings view.settings" i18n:domain="pyams_content">
+    <strong tal:define="title i18n:settings.title"
+            tal:condition="title"
+            tal:content="title + ' : '">Title</strong>
+    <span tal:content="settings.teaser"></span>
+    <ul>
+	    <li tal:repeat="number settings.keynumbers.get_visible_items()">
+			<span tal:define="label i18n:number.label"
+                  tal:condition="label"
+				  tal:content="label + ' : '">label</span>
+			<span tal:define="number i18n:number.number"
+				  tal:content="number or '--'" class="badge">Number</span>
+			<span tal:define="unit i18n:number.unit"
+				  tal:content="unit or '......'">Unit</span>
+			<span tal:define="txt i18n:number.text"
+				  tal:content="txt">text</span>
+		</li>
+	</ul>
+</div>