# HG changeset patch # User Thierry Florac # Date 1542639820 -3600 # Node ID 7a431c7ffcef839ceae8d50de79d5028b721a2cc # Parent 226ee150715715a11808e4aae18f196b4abfc647 Updated paragraph's illustration marker diff -r 226ee1507157 -r 7a431c7ffcef 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