Merge branch dev-dc
authorThierry Florac <thierry.florac@onf.fr>
Fri, 20 Jul 2018 10:13:00 +0200
changeset 111 0a71298d125a
parent 108 da1f756d7158 (current diff)
parent 110 a0c0663baf9e (diff)
child 112 7521386577af
Merge branch dev-dc
src/pyams_default_theme/component/paragraph/keynumber.py
src/pyams_default_theme/component/paragraph/templates/keynumber-default.pt
--- a/src/pyams_default_theme/component/paragraph/keynumber.py	Fri Jul 20 01:42:45 2018 +0200
+++ b/src/pyams_default_theme/component/paragraph/keynumber.py	Fri Jul 20 10:13:00 2018 +0200
@@ -12,11 +12,11 @@
 
 __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
 
@@ -32,10 +32,14 @@
 #  Base Key numbers paragraph renderer
 #
 
-class BaseKeyNumberRenderer(BaseContentRenderer):
+class BaseKeyNumberParagraphRenderer(BaseContentRenderer):
     """Default Key Numbers renderer"""
 
-    i18n_context_attrs = ('title',)
+    i18n_context_attrs = ('title', )
+
+    @property
+    def keynumbers(self):
+        return IKeyNumberContainer(self.context)
 
 
 #
@@ -44,7 +48,7 @@
 
 @adapter_config(name='default', context=(IKeyNumberParagraph, IPyAMSLayer), provides=IContentRenderer)
 @template_config(template='templates/keynumber-default.pt', layer=IPyAMSLayer)
-class DefaultKeyNumberParagraphRenderer(BaseKeyNumberRenderer):
+class DefaultKeyNumberParagraphRenderer(BaseKeyNumberParagraphRenderer):
     """Default Key Numbers renderer"""
 
     label = _("Default key numbers renderer")
--- a/src/pyams_default_theme/component/paragraph/templates/keynumber-default.pt	Fri Jul 20 01:42:45 2018 +0200
+++ b/src/pyams_default_theme/component/paragraph/templates/keynumber-default.pt	Fri Jul 20 10:13:00 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>