9 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS |
9 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS |
10 # FOR A PARTICULAR PURPOSE. |
10 # FOR A PARTICULAR PURPOSE. |
11 # |
11 # |
12 |
12 |
13 __docformat__ = 'restructuredtext' |
13 __docformat__ = 'restructuredtext' |
|
14 |
|
15 import json |
14 |
16 |
15 from pyramid.renderers import render |
17 from pyramid.renderers import render |
16 from zope.interface import Interface |
18 from zope.interface import Interface |
17 |
19 |
18 from pyams_utils.adapter import ContextRequestViewAdapter, adapter_config |
20 from pyams_utils.adapter import ContextRequestViewAdapter, adapter_config |
33 embedding all image attributes. |
35 embedding all image attributes. |
34 """ |
36 """ |
35 |
37 |
36 def render(self, context=None, lg_thumb='lg', lg_width=12, md_thumb='md', md_width=12, |
38 def render(self, context=None, lg_thumb='lg', lg_width=12, md_thumb='md', md_width=12, |
37 sm_thumb='sm', sm_width=12, xs_thumb='xs', xs_width=12, |
39 sm_thumb='sm', sm_width=12, xs_thumb='xs', xs_width=12, |
38 def_thumb=None, def_width=None, alt='', css_class='', img_width='100%'): |
40 def_thumb=None, def_width=None, alt='', css_class='', pic_class=None, |
|
41 img_width='100%', data=None): |
39 if context is None: |
42 if context is None: |
40 context = self.context |
43 context = self.context |
41 if context.content_type.startswith('image/svg'): |
44 if context.content_type.startswith('image/svg'): |
42 return render('templates/svg-picture.pt', { |
45 return render('templates/svg-picture.pt', { |
43 'image': context, |
46 'image': context, |
65 'xs_thumb': xs_thumb, |
69 'xs_thumb': xs_thumb, |
66 'xs_width': xs_width, |
70 'xs_width': xs_width, |
67 'def_thumb': def_thumb, |
71 'def_thumb': def_thumb, |
68 'def_width': def_width, |
72 'def_width': def_width, |
69 'alt': alt, |
73 'alt': alt, |
|
74 'pic_class': pic_class, |
70 'css_class': css_class, |
75 'css_class': css_class, |
71 'img_width': img_width |
76 'img_width': img_width, |
|
77 'data': data |
72 }, request=self.request) |
78 }, request=self.request) |