# HG changeset patch # User Thierry Florac # Date 1528893821 -7200 # Node ID c36df330086105d373e0987515caec7bec602408 # Parent 49314bf50fb25155d077d45c92705827eb2a7d94 Added imagemap preview diff -r 49314bf50fb2 -r c36df3300861 src/pyams_default_theme/shared/imagemap/__init__.py --- a/src/pyams_default_theme/shared/imagemap/__init__.py Wed Jun 13 14:01:05 2018 +0200 +++ b/src/pyams_default_theme/shared/imagemap/__init__.py Wed Jun 13 14:43:41 2018 +0200 @@ -19,10 +19,13 @@ from pyams_content.component.association.interfaces import IAssociationInfo from pyams_content.features.renderer.interfaces import IContentRenderer from pyams_content.shared.imagemap.interfaces import IWfImageMap, IImageMapParagraph -from pyams_skin.layer import IPyAMSLayer +from pyams_skin.layer import IPyAMSLayer, IPyAMSUserLayer +from pyams_utils.interfaces import VIEW_SYSTEM_PERMISSION # import packages from pyams_content.features.renderer.skin import BaseContentRenderer +from pyams_default_theme.page import BasePreviewPage +from pyams_pagelet.pagelet import pagelet_config from pyams_template.template import template_config from pyams_utils.adapter import adapter_config @@ -30,16 +33,15 @@ # -# Imagemap renderer +# Imagemap preview # -@adapter_config(name='imagemap-render', context=(IWfImageMap, IPyAMSLayer), provides=IContentRenderer) +@pagelet_config(name='preview.html', context=IWfImageMap, layer=IPyAMSUserLayer, + permission=VIEW_SYSTEM_PERMISSION) @template_config(template='templates/render.pt', layer=IPyAMSLayer) -class ImagemapRenderer(BaseContentRenderer): +class ImagemapRenderer(BasePreviewPage): """Image map renderer""" - weight = 20 - def get_item_info(self, item): return IAssociationInfo(item, None) diff -r 49314bf50fb2 -r c36df3300861 src/pyams_default_theme/shared/imagemap/templates/render.pt --- a/src/pyams_default_theme/shared/imagemap/templates/render.pt Wed Jun 13 14:01:05 2018 +0200 +++ b/src/pyams_default_theme/shared/imagemap/templates/render.pt Wed Jun 13 14:43:41 2018 +0200 @@ -1,10 +1,7 @@ -
+
+ tal:attributes="src extension:absolute_url(image);" />