--- a/src/pyams_default_theme/component/paragraph/keynumber.py Thu Jul 19 18:28:08 2018 +0200
+++ b/src/pyams_default_theme/component/paragraph/keynumber.py Thu Jul 19 18:28:28 2018 +0200
@@ -12,31 +12,35 @@
__docformat__ = 'restructuredtext'
-
# import standard library
# import interfaces
from pyams_content.component.paragraph.interfaces.keynumber import IKeyNumberParagraph
-from pyams_content.features.renderer.interfaces import IContentRenderer
+from pyams_content.component.keynumber import IKeyNumberContainer
+from pyams_content.features.renderer import IContentRenderer
from pyams_skin.layer import IPyAMSLayer
# import packages
from pyams_content.features.renderer.skin import BaseContentRenderer
+from pyams_default_theme import _
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 BaseKeyNumberRenderer(BaseContentRenderer):
+class BaseKeyNumberParagraphRenderer(BaseContentRenderer):
"""Default Key Numbers renderer"""
i18n_context_attrs = ('title',)
+ @property
+ def keynumbers(self):
+ return IKeyNumberContainer(self.context)
+
#
# Key numbers paragraph default renderer
@@ -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 Thu Jul 19 18:28:08 2018 +0200
+++ b/src/pyams_default_theme/component/paragraph/templates/keynumber-default.pt Thu Jul 19 18:28:28 2018 +0200
@@ -0,0 +1,18 @@
+<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" tal:content="i18n:number.label">label</span>
+ </div>
+ <div class="panel-body text-align-center">
+ <span class="h4 text-success" tal:content="i18n:number.number">Number</span>
+ <span class="h5" tal:content="i18n:number.unit">Unit</span>
+ </div>
+ <div class="panel-footer">
+ <p tal:content="i18n:number.text">Text</p>
+ </div>
+ </div>
+ </div>
+</tal:var>