diff -r 26d51b558325 -r 4541a452fd4c src/pyams_content/component/illustration/zmi/paragraph.py --- a/src/pyams_content/component/illustration/zmi/paragraph.py Fri Jun 15 15:29:30 2018 +0200 +++ b/src/pyams_content/component/illustration/zmi/paragraph.py Fri Jun 15 18:18:16 2018 +0200 @@ -18,13 +18,15 @@ # import interfaces from pyams_content.component.paragraph.interfaces import IParagraphContainerTarget, \ IParagraphContainer -from pyams_content.component.illustration.interfaces import IIllustration, IIllustrationParagraph, \ - ILLUSTRATION_PARAGRAPH_TYPE -from pyams_content.component.paragraph.zmi.interfaces import IParagraphInnerEditor, IParagraphContainerView +from pyams_content.component.illustration.interfaces import IIllustrationTarget, IIllustration, \ + IIllustrationParagraph, ILLUSTRATION_PARAGRAPH_TYPE +from pyams_content.component.paragraph.zmi.interfaces import IParagraphInnerEditor, IParagraphContainerView, \ + IParagraphContainerTable, IParagraphTitleToolbar from pyams_content.interfaces import MANAGE_CONTENT_PERMISSION from pyams_form.interfaces.form import IInnerForm from pyams_skin.interfaces.viewlet import IToolbarAddingMenu from pyams_skin.layer import IPyAMSLayer +from pyams_utils.interfaces import VIEW_SYSTEM_PERMISSION from transaction.interfaces import ITransactionManager from z3c.form.interfaces import INPUT_MODE @@ -36,8 +38,9 @@ from pyams_form.form import ajax_config from pyams_pagelet.pagelet import pagelet_config from pyams_skin.event import get_json_form_refresh_event +from pyams_template.template import template_config from pyams_utils.adapter import adapter_config -from pyams_viewlet.viewlet import viewlet_config +from pyams_viewlet.viewlet import viewlet_config, Viewlet from pyams_zmi.form import AdminDialogAddForm from z3c.form import field, button from zope.interface import implementer @@ -147,3 +150,29 @@ output.setdefault('events', []).append(get_json_form_refresh_event(self.context, self.request, IllustrationInnerEditForm)) return output + + +# +# Paragraph container illustration marker +# + +@viewlet_config(name='illustration', context=IIllustrationTarget, layer=IPyAMSLayer, view=IParagraphContainerTable, + manager=IParagraphTitleToolbar, permission=VIEW_SYSTEM_PERMISSION, weight=5) +@template_config(template='templates/paragraph-illustration-icon.pt', layer=IPyAMSLayer) +class ParagraphContainerIllustrationMarker(Viewlet): + """Paragraph container illustration marker column""" + + weight = 5 + action_class = 'action illustration nowrap width-40' + icon_class = 'fa fa-fw fa-picture-o' + icon_hint = _("Illustration") + + marker_type = 'illustration' + + def render(self): + illustration = IIllustration(self.context, None) + if illustration and illustration.data: + for value in illustration.data.values(): + if value: + return super(ParagraphContainerIllustrationMarker, self).render() + return ''