Updated paragraph's illustration marker
authorThierry Florac <thierry.florac@onf.fr>
Mon, 19 Nov 2018 16:03:40 +0100
changeset 1106 7a431c7ffcef
parent 1105 226ee1507157
child 1107 2f07bcec4271
Updated paragraph's illustration marker
src/pyams_content/component/illustration/zmi/paragraph.py
--- a/src/pyams_content/component/illustration/zmi/paragraph.py	Mon Nov 19 14:51:59 2018 +0100
+++ b/src/pyams_content/component/illustration/zmi/paragraph.py	Mon Nov 19 16:03:40 2018 +0100
@@ -24,6 +24,7 @@
 from pyams_content.component.paragraph.zmi import BaseParagraphAJAXAddForm, BaseParagraphAJAXEditForm, \
     BaseParagraphAddMenu, BaseParagraphPropertiesEditForm, IParagraphInnerEditFormButtons, \
     get_json_paragraph_refresh_event
+from pyams_content.component.paragraph.zmi.container import ParagraphContainerCounterBase
 from pyams_content.component.paragraph.zmi.interfaces import IParagraphContainerTable, IParagraphContainerView, \
     IParagraphInnerEditor, IParagraphTitleToolbar
 from pyams_content.features.renderer.zmi.widget import RendererFieldWidget
@@ -34,10 +35,9 @@
 from pyams_skin.event import get_json_form_refresh_event
 from pyams_skin.interfaces.viewlet import IToolbarAddingMenu
 from pyams_skin.layer import IPyAMSLayer
-from pyams_template.template import template_config
 from pyams_utils.adapter import adapter_config
 from pyams_utils.interfaces import VIEW_SYSTEM_PERMISSION
-from pyams_viewlet.viewlet import Viewlet, viewlet_config
+from pyams_viewlet.viewlet import viewlet_config
 from pyams_zmi.form import AdminDialogAddForm
 
 from pyams_content import _
@@ -145,8 +145,7 @@
                 manager=IParagraphTitleToolbar, permission=VIEW_SYSTEM_PERMISSION, weight=5)
 @viewlet_config(name='illustration', context=IBasicIllustrationTarget, layer=IPyAMSLayer, view=IParagraphContainerTable,
                 manager=IParagraphTitleToolbar, permission=VIEW_SYSTEM_PERMISSION, weight=5)
-@template_config(template='templates/paragraph-illustration-icon.pt', layer=IPyAMSLayer)
-class ParagraphIllustrationMarker(Viewlet):
+class ParagraphIllustrationMarker(ParagraphContainerCounterBase):
     """Paragraph illustration marker column"""
 
     weight = 5
@@ -156,10 +155,11 @@
 
     marker_type = 'illustration'
 
-    def render(self):
+    @property
+    def count(self):
         illustration = IIllustration(self.context, None)
         if illustration and illustration.data:
             for value in illustration.data.values():
                 if value:
-                    return super(ParagraphIllustrationMarker, self).render()
-        return ''
+                    return 1
+        return 0