src/pyams_file/skin/__init__.py
changeset 218 458cf3d033aa
parent 167 4760ae4610ac
child 219 1c07e0c889ba
--- a/src/pyams_file/skin/__init__.py	Tue Jan 12 13:35:20 2021 +0100
+++ b/src/pyams_file/skin/__init__.py	Tue May 04 12:38:32 2021 +0200
@@ -35,36 +35,38 @@
 
     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,
-               def_thumb=None, def_width=None, alt='', css_class=''):
+               def_thumb=None, def_width=None, alt='', css_class='', img_width='100%'):
         if context is None:
             context = self.context
         if context.content_type.startswith('image/svg'):
-            return render('templates/svg-picture.pt',
-                          {'image': context,
-                           'lg_width': lg_width,
-                           'md_width': md_width,
-                           'sm_width': sm_width,
-                           'xs_width': xs_width,
-                           'alt': alt,
-                           'css_class': css_class},
-                          request=self.request)
+            return render('templates/svg-picture.pt', {
+                'image': context,
+                'lg_width': lg_width,
+                'md_width': md_width,
+                'sm_width': sm_width,
+                'xs_width': xs_width,
+                'alt': alt,
+                'css_class': css_class,
+                'img_width': img_width
+            }, request=self.request)
         else:
             if def_thumb is None:
                 def_thumb = md_thumb or lg_thumb or sm_thumb or xs_thumb
             if def_width is None:
                 def_width = md_width or lg_width or sm_width or xs_width
-            return render('templates/picture.pt',
-                          {'image': context,
-                           'lg_thumb': lg_thumb,
-                           'lg_width': lg_width,
-                           'md_thumb': md_thumb,
-                           'md_width': md_width,
-                           'sm_thumb': sm_thumb,
-                           'sm_width': sm_width,
-                           'xs_thumb': xs_thumb,
-                           'xs_width': xs_width,
-                           'def_thumb': def_thumb,
-                           'def_width': def_width,
-                           'alt': alt,
-                           'css_class': css_class},
-                          request=self.request)
\ No newline at end of file
+            return render('templates/picture.pt', {
+                'image': context,
+                'lg_thumb': lg_thumb,
+                'lg_width': lg_width,
+                'md_thumb': md_thumb,
+                'md_width': md_width,
+                'sm_thumb': sm_thumb,
+                'sm_width': sm_width,
+                'xs_thumb': xs_thumb,
+                'xs_width': xs_width,
+                'def_thumb': def_thumb,
+                'def_width': def_width,
+                'alt': alt,
+                'css_class': css_class,
+                'img_width': img_width
+            }, request=self.request)