# HG changeset patch # User Thierry Florac # Date 1519032126 -3600 # Node ID fe989328a54f5b669576df54c3602c607bfd8f43 # Parent a6c3d1974420552ff894f217b470abddbe01e2ec Added shared "hidden" renderer diff -r a6c3d1974420 -r fe989328a54f src/pyams_content/component/illustration/interfaces/__init__.py --- a/src/pyams_content/component/illustration/interfaces/__init__.py Thu Feb 15 15:10:27 2018 +0100 +++ b/src/pyams_content/component/illustration/interfaces/__init__.py Mon Feb 19 10:22:06 2018 +0100 @@ -88,7 +88,8 @@ renderer = Choice(title=_("Illustration template"), description=_("Presentation template used for illustration"), - vocabulary='PyAMS illustration renderers') + vocabulary='PyAMS illustration renderers', + default='hidden') language = Choice(title=_("Language"), description=_("File's content language"), diff -r a6c3d1974420 -r fe989328a54f src/pyams_content/component/illustration/zmi/renderer.py --- a/src/pyams_content/component/illustration/zmi/renderer.py Thu Feb 15 15:10:27 2018 +0100 +++ b/src/pyams_content/component/illustration/zmi/renderer.py Mon Feb 19 10:22:06 2018 +0100 @@ -52,17 +52,6 @@ self.legend = i18n.query_attribute('alt_title', request=self.request) -@adapter_config(name='hidden', context=(IIllustration, IPyAMSLayer), provides=IContentRenderer) -class HiddenIllustrationRenderer(BaseIllustrationRenderer): - """Hidden illustration renderer""" - - label = _("Hidden illustration") - weight = -999 - - def render(self): - return '' - - @adapter_config(name='default', context=(IIllustration, IPyAMSLayer), provides=IContentRenderer) @template_config(template='templates/renderer-default.pt', layer=IPyAMSLayer) class DefaultIllustrationRenderer(BaseIllustrationRenderer): diff -r a6c3d1974420 -r fe989328a54f src/pyams_content/features/renderer/zmi/__init__.py --- a/src/pyams_content/features/renderer/zmi/__init__.py Thu Feb 15 15:10:27 2018 +0100 +++ b/src/pyams_content/features/renderer/zmi/__init__.py Mon Feb 19 10:22:06 2018 +0100 @@ -24,7 +24,7 @@ from pyams_form.form import AJAXEditForm from pyams_pagelet.pagelet import pagelet_config from pyams_template.template import get_view_template -from pyams_utils.adapter import ContextRequestAdapter +from pyams_utils.adapter import ContextRequestAdapter, adapter_config from pyams_zmi.form import AdminDialogEditForm from pyramid.view import view_config from z3c.form import field @@ -45,6 +45,9 @@ return None return IRendererSettings(self.context) + def update(self): + pass + render = get_view_template() @@ -72,3 +75,18 @@ permission=MANAGE_CONTENT_PERMISSION, renderer='json', xhr=True) class RendererPropertiesAJAXEditForm(AJAXEditForm, RendererPropertiesEditForm): """Renderer properties edit form, JSON renderer""" + + +# +# Default common renderers +# + +@adapter_config(name='hidden', context=(IRenderedContent, IPyAMSLayer), provides=IContentRenderer) +class HiddenContentRenderer(BaseContentRenderer): + """Hidden content renderer""" + + label = _("Hidden content") + weight = -999 + + def render(self): + return ''