Add check before rendering empty map areas
authorThierry Florac <thierry.florac@onf.fr>
Wed, 14 Jun 2017 15:19:03 +0200
changeset 84 7214a95eaa9b
parent 83 cedc7584a81f
child 85 f6474843036e
Add check before rendering empty map areas
src/pyams_content/shared/imagemap/zmi/templates/summary.pt
--- a/src/pyams_content/shared/imagemap/zmi/templates/summary.pt	Thu Jun 08 11:34:40 2017 +0200
+++ b/src/pyams_content/shared/imagemap/zmi/templates/summary.pt	Wed Jun 14 15:19:03 2017 +0200
@@ -9,11 +9,14 @@
 				 tal:attributes="src extension:absolute_url(image);"
 				 data-ams-callback="PyAMS_content.imgmap.initSummary" />
 			<map name="imagemap_preview">
-				<area tal:repeat="area context.areas.values()"
-					  shape="poly"
-					  tal:attributes="coords area.area;
-									  href view.get_url(area.link);
-									  title i18n:area.title;" />
+				<tal:loop repeat="area context.areas.values()">
+					<area tal:define="href view.get_url(area.link)"
+						  tal:condition="href"
+						  shape="poly"
+						  tal:attributes="coords area.area;
+										  href href;
+										  title i18n:area.title;" />
+				</tal:loop>
 			</map>
 		</div>
 	</fieldset>