Updated video renderer template to use new "video" TALES extension
authorThierry Florac <tflorac@ulthar.net>
Wed, 19 Dec 2018 16:56:36 +0100
changeset 298 2e28f2f2a3d0
parent 297 2d9623dc5c56
child 299 66ef165934a9
Updated video renderer template to use new "video" TALES extension
src/pyams_default_theme/component/paragraph/templates/video-default.pt
--- a/src/pyams_default_theme/component/paragraph/templates/video-default.pt	Wed Dec 19 11:02:50 2018 +0100
+++ b/src/pyams_default_theme/component/paragraph/templates/video-default.pt	Wed Dec 19 16:56:36 2018 +0100
@@ -4,22 +4,6 @@
 		tal:content="view.title">title</h3>
 	<div tal:condition="view.description"
 		 tal:content="structure tales:html(view.description)">Description</div>
-	<video controls
-		tal:define="video view.data;
-					href tales:absolute_url(video);
-					thumbnails tales:thumbnails(video);
-					conversions tales:conversions(video);
-					size thumbnails.get_image_size();"
-		tal:attributes="poster string:${href}/++thumb++${size[0]}x${size[1]}.png">
-		<tal:loop repeat="conversion conversions.get_conversions(order=('video/webm','video/mp4','video/x-flv'))">
-			<source type="video/mp4"
-					tal:define="media_width conversions.get_conversion_width(conversion.__name__);
-								video_type tales:video_type(conversion);"
-					tal:condition="video_type"
-					tal:attributes="type video_type;
-									src tales:absolute_url(conversion);
-									media 'all and (max-width: {0}px)'.format(media_width) if media_width else None;" />
-		</tal:loop>
-	</video>
+	${structure:tales:video(view.data)}
 	<div class="author">${view.author}</div>
 </section>