Refactored keynumber paragraph
authorThierry Florac <thierry.florac@onf.fr>
Thu, 30 Aug 2018 11:07:17 +0200
changeset 122 d83485dee19a
parent 121 81cd2db6df7a
child 123 9638eaef9d34
Refactored keynumber paragraph
src/pyams_default_theme/component/keynumber/__init__.py
src/pyams_default_theme/component/keynumber/templates/keynumber-default.pt
src/pyams_default_theme/component/paragraph/keynumber.py
src/pyams_default_theme/component/paragraph/templates/keynumber-default.pt
--- a/src/pyams_default_theme/component/keynumber/__init__.py	Mon Aug 27 11:31:27 2018 +0200
+++ b/src/pyams_default_theme/component/keynumber/__init__.py	Thu Aug 30 11:07:17 2018 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2008-2018 Thierry Florac <tflorac AT ulthar.net>
+# 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,
@@ -12,9 +12,43 @@
 
 __docformat__ = 'restructuredtext'
 
-
 # import standard library
 
 # import interfaces
+from pyams_content.component.keynumber.interfaces import IKeyNumberContainer, IKeyNumberParagraph
+from pyams_content.features.renderer.interfaces import IContentRenderer
+from pyams_skin.layer import IPyAMSLayer
 
 # import packages
+from pyams_content.features.renderer.skin import BaseContentRenderer
+from pyams_template.template import template_config
+from pyams_utils.adapter import adapter_config
+
+from pyams_default_theme import _
+
+
+#
+#  Base Key numbers paragraph renderer
+#
+
+class BaseKeyNumberParagraphRenderer(BaseContentRenderer):
+    """Default Key Numbers renderer"""
+
+    i18n_context_attrs = ('title', )
+
+    @property
+    def keynumbers(self):
+        return IKeyNumberContainer(self.context)
+
+
+#
+#  Key numbers paragraph default renderer
+#
+
+@adapter_config(name='default', context=(IKeyNumberParagraph, IPyAMSLayer), provides=IContentRenderer)
+@template_config(template='templates/keynumber-default.pt', layer=IPyAMSLayer)
+class DefaultKeyNumberParagraphRenderer(BaseKeyNumberParagraphRenderer):
+    """Default Key Numbers renderer"""
+
+    label = _("Default key numbers renderer")
+    weight = 1
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_default_theme/component/keynumber/templates/keynumber-default.pt	Thu Aug 30 11:07:17 2018 +0200
@@ -0,0 +1,19 @@
+<tal:var i18n:domain="pyams_default_theme"
+         define="numbers list(view.keynumbers.get_visible_items())">
+	<h3>${i18n:view.title}</h3>
+		<div class="col-md-3 col-lg-3"
+			 tal:repeat="number numbers">
+			<div class="panel panel-default">
+				<div class="panel-heading">
+					<span class="lead">${i18n:number.label}</span>
+				</div>
+				<div class="panel-body text-align-center">
+					<span class="h4 text-success">${i18n:number.number}</span>
+					<span class="h5">${i18n:number.unit}</span>
+				</div>
+				<div class="panel-footer">
+					<p>${i18n:number.text}</p>
+				</div>
+			</div>
+		</div>
+</tal:var>
--- a/src/pyams_default_theme/component/paragraph/keynumber.py	Mon Aug 27 11:31:27 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-#
-# 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.component.paragraph.interfaces.keynumber import IKeyNumberParagraph
-from pyams_content.component.keynumber.interfaces import IKeyNumberContainer
-from pyams_content.features.renderer.interfaces import IContentRenderer
-from pyams_skin.layer import IPyAMSLayer
-
-# import packages
-from pyams_content.features.renderer.skin import BaseContentRenderer
-from pyams_template.template import template_config
-from pyams_utils.adapter import adapter_config
-
-from pyams_default_theme import _
-
-
-#
-#  Base Key numbers paragraph renderer
-#
-
-class BaseKeyNumberParagraphRenderer(BaseContentRenderer):
-    """Default Key Numbers renderer"""
-
-    i18n_context_attrs = ('title', )
-
-    @property
-    def keynumbers(self):
-        return IKeyNumberContainer(self.context)
-
-
-#
-#  Key numbers paragraph default renderer
-#
-
-@adapter_config(name='default', context=(IKeyNumberParagraph, IPyAMSLayer), provides=IContentRenderer)
-@template_config(template='templates/keynumber-default.pt', layer=IPyAMSLayer)
-class DefaultKeyNumberParagraphRenderer(BaseKeyNumberParagraphRenderer):
-    """Default Key Numbers renderer"""
-
-    label = _("Default key numbers renderer")
-    weight = 1
--- a/src/pyams_default_theme/component/paragraph/templates/keynumber-default.pt	Mon Aug 27 11:31:27 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,19 +0,0 @@
-<tal:var i18n:domain="pyams_default_theme"
-         define="numbers list(view.keynumbers.get_visible_items())">
-	<h3>${i18n:view.title}</h3>
-		<div class="col-md-3 col-lg-3"
-			 tal:repeat="number numbers">
-			<div class="panel panel-default">
-				<div class="panel-heading">
-					<span class="lead">${i18n:number.label}</span>
-				</div>
-				<div class="panel-body text-align-center">
-					<span class="h4 text-success">${i18n:number.number}</span>
-					<span class="h5">${i18n:number.unit}</span>
-				</div>
-				<div class="panel-footer">
-					<p>${i18n:number.text}</p>
-				</div>
-			</div>
-		</div>
-</tal:var>