Added "alt" argument to picture
authorThierry Florac <thierry.florac@onf.fr>
Tue, 17 Jul 2018 11:12:44 +0200
changeset 123 01eb2fba1632
parent 122 e6e53cb1785c
child 124 0d209477b6c4
Added "alt" argument to picture
src/pyams_file/image.py
src/pyams_file/templates/picture.pt
--- a/src/pyams_file/image.py	Mon Jul 16 12:14:21 2018 +0200
+++ b/src/pyams_file/image.py	Tue Jul 17 11:12:44 2018 +0200
@@ -264,7 +264,7 @@
     """
 
     def render(self, context=None, lg_thumb='lg', lg_width=12, md_thumb='md', md_width=12,
-               sm_thumb='sm', sm_width=12, xs_thumb='xs', xs_width=12, css_class=''):
+               sm_thumb='sm', sm_width=12, xs_thumb='xs', xs_width=12, alt='', css_class=''):
         if context is None:
             context = self.context
         return render('templates/picture.pt',
@@ -277,5 +277,6 @@
                        'sm_width': sm_width,
                        'xs_thumb': xs_thumb,
                        'xs_width': xs_width,
+                       'alt': alt,
                        'css_class': css_class},
                       request=self.request)
--- a/src/pyams_file/templates/picture.pt	Mon Jul 16 12:14:21 2018 +0200
+++ b/src/pyams_file/templates/picture.pt	Tue Jul 17 11:12:44 2018 +0200
@@ -49,5 +49,5 @@
 			tal:condition="not:xs_width" />
 	<!-- fallback image -->
 	<img style="width: 100%;"
-		 tal:attributes="src image_url" />
+		 tal:attributes="alt alt; src image_url" />
 </picture>