# HG changeset patch # User Thierry Florac # Date 1620124712 -7200 # Node ID 458cf3d033aacd51b8dcc2e617f75ce543d5a370 # Parent 48a990f311cb1ce23ec58335cdea62a46dad3b9b Added argument to "picture" TALES expression diff -r 48a990f311cb -r 458cf3d033aa src/pyams_file/skin/__init__.py --- 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) diff -r 48a990f311cb -r 458cf3d033aa src/pyams_file/skin/templates/picture.pt --- a/src/pyams_file/skin/templates/picture.pt Tue Jan 12 13:35:20 2021 +0100 +++ b/src/pyams_file/skin/templates/picture.pt Tue May 04 12:38:32 2021 +0200 @@ -46,7 +46,7 @@ srcset="/--static--/myams/img/dot.png" /> - - ${alt}