Added imagemap preview
authorThierry Florac <thierry.florac@onf.fr>
Wed, 13 Jun 2018 14:43:41 +0200
changeset 44 c36df3300861
parent 43 49314bf50fb2
child 45 eca8c37969a9
Added imagemap preview
src/pyams_default_theme/shared/imagemap/__init__.py
src/pyams_default_theme/shared/imagemap/templates/render.pt
--- 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)
 
--- 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 @@
-<div class="padding-y-5" i18n:domain="pyams_content"
-	 data-ams-plugins="pyams_content"
-	 tal:attributes="data-ams-plugin-pyams_content-src extension:resource_path('pyams_content.skin:pyams_content')">
+<div class="padding-y-5" i18n:domain="pyams_content">
 	<img usemap="#imagemap_preview"
 		 tal:define="image i18n:context.image"
-		 tal:attributes="src extension:absolute_url(image);"
-		 data-ams-callback="PyAMS_content.imgmap.initSummary" />
+		 tal:attributes="src extension:absolute_url(image);" />
 	<map name="imagemap_preview">
 		<tal:loop repeat="area context.areas.values()">
 			<tal:var define="item context.get_association(area)"