# HG changeset patch # User Thierry Florac # Date 1527228398 -7200 # Node ID f0b28eb0bdf03a0a6d9fe1cd0a22a9d683c2829f # Parent 566d98116bf2f89f459249b8d04c3017db50f0f8 Add default renderer to image map paragraph diff -r 566d98116bf2 -r f0b28eb0bdf0 src/pyams_default_theme/shared/imagemap/__init__.py --- a/src/pyams_default_theme/shared/imagemap/__init__.py Fri May 25 08:06:07 2018 +0200 +++ b/src/pyams_default_theme/shared/imagemap/__init__.py Fri May 25 08:06:38 2018 +0200 @@ -17,17 +17,16 @@ # import interfaces from pyams_content.component.association.interfaces import IAssociationInfo -from pyams_content.component.paragraph.interfaces import IParagraphRenderer from pyams_content.features.renderer.interfaces import IContentRenderer from pyams_content.shared.imagemap.interfaces import IWfImageMap, IImageMapParagraph -from pyams_i18n.interfaces import II18n from pyams_skin.layer import IPyAMSLayer # import packages from pyams_content.features.renderer.skin import BaseContentRenderer from pyams_template.template import template_config from pyams_utils.adapter import adapter_config -from pyams_viewlet.viewlet import BaseContentProvider + +from pyams_default_theme import _ # @@ -49,19 +48,14 @@ # Imagemap paragraph renderer # -@adapter_config(context=(IImageMapParagraph, IPyAMSLayer), provides=IParagraphRenderer) -@template_config(template='templates/paragraph-render.pt', layer=IPyAMSLayer) -class ImagemapParagraphRenderer(BaseContentProvider): - """Image map paragraph renderer""" - - language = None +@adapter_config(name='default', context=(IImageMapParagraph, IPyAMSLayer), provides=IContentRenderer) +@template_config(template='templates/imagemap-default.pt', layer=IPyAMSLayer) +class ImagemapDefaultParagraphRenderer(BaseContentRenderer): + """Image map default paragraph renderer""" - def update(self): - i18n = II18n(self.context) - if self.language: - setattr(self, 'title', i18n.get_attribute('title', self.language, request=self.request)) - else: - setattr(self, 'title', i18n.query_attribute('title', request=self.request)) + label = _("Default imagemap renderer") + + i18n_context_attrs = ('title', ) def get_item_info(self, item): return IAssociationInfo(item, None) diff -r 566d98116bf2 -r f0b28eb0bdf0 src/pyams_default_theme/shared/imagemap/templates/imagemap-default.pt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_default_theme/shared/imagemap/templates/imagemap-default.pt Fri May 25 08:06:38 2018 +0200 @@ -0,0 +1,27 @@ +

title

+
+ + + + + + + + +
diff -r 566d98116bf2 -r f0b28eb0bdf0 src/pyams_default_theme/shared/imagemap/templates/paragraph-render.pt --- a/src/pyams_default_theme/shared/imagemap/templates/paragraph-render.pt Fri May 25 08:06:07 2018 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -

title

-
- - - - - - - - -