Don't display download button when gallery is empty
authorThierry Florac <thierry.florac@onf.fr>
Tue, 03 Apr 2018 17:10:39 +0200
changeset 512 f282127bc420
parent 511 47e890a95d41
child 513 c65e71af9288
Don't display download button when gallery is empty
src/pyams_content/component/gallery/zmi/templates/gallery-medias.pt
--- a/src/pyams_content/component/gallery/zmi/templates/gallery-medias.pt	Tue Apr 03 17:00:58 2018 +0200
+++ b/src/pyams_content/component/gallery/zmi/templates/gallery-medias.pt	Tue Apr 03 17:10:39 2018 +0200
@@ -1,5 +1,6 @@
 <div class="form-group" i18n:domain="pyams_content"
 	 data-ams-plugins="pyams_content"
+	 tal:define="gallery_images context.values()"
 	 tal:attributes="data-ams-plugin-pyams_content-src extension:resource_path('pyams_content.skin:pyams_content');
 					 id string:gallery_medias_${context.__name__};"
 	 data-ams-plugin-pyams_content-async="false">
@@ -9,7 +10,8 @@
 			tal:attributes="data-ams-switcher-state 'open' if context.values() else None">
 			<i18n:var translate="">Gallery medias</i18n:var>
 		</legend>
-		<div class="btn-group pull-right">
+		<div class="btn-group pull-right"
+			 tal:condition="gallery_images">
 			<a class="btn btn-xs btn-primary"
 			   tal:attributes="href extension:absolute_url(context, 'get-medias.zip')"
 			   i18n:translate="">Download medias</a>
@@ -27,7 +29,7 @@
 			 data-ams-fancybox-loop="false"
 			 data-ams-fancybox-elements="a.fancyimg"
 			 data-ams-fancybox-after-load="PyAMS_content.galleries.afterFancyboxLoad">
-			<div tal:repeat="media context.values()"
+			<div tal:repeat="media gallery_images"
 				 class="media margin-5 margin-bottom-10 radius-4 padding-5 pull-left text-center"
 				 style="position: relative;"
 				 tal:attributes="data-ams-element-name media.__name__">