file_upload.pt
1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<p tal:define="preview_url cstruct.get('preview_url');
css_class css_class|field.widget.css_class;
style style|field.widget.style;
preview_url cstruct.get('preview_url')|'';
ext str(cstruct.get('filename').split('.')[-1:][0]).lower()|[];
fname str(cstruct.get('filename'))|'';
delete cstruct.get('delete')|'';
ext str(cstruct.get('filename').split('.')[-1:][0]).lower()|[];
img ['jpg', 'jpeg', 'gif', 'png', 'svg', 'eps', 'psd'];
video ['avi', 'mov', 'mpv'];
">
<img tal:condition="ext in img" id="preview-${oid}" alt="" src="${preview_url}"
style="${style}"
onload="window.URL.revokeObjectURL(this.src);"></img>
<video tal:condition="ext in video" style="${style}" controls
src="${preview_url}" type="video/${ext}">
Your browser does not support the video tag.
</video>
<video tal:condition="ext=='mp4'"
controls
style="${style}"
src="${preview_url}"
type="video/mp4">
Your browser does not support the video tag.
</video>
<embed tal:condition="ext=='pdf'" src="${preview_url}" style="${style}">
<tal:block tal:condition="preview_url and ext in ['jpg','jpeg','png','bmp','gif']">
<img src="${structure: preview_url}" style="width:100px;height:auto;"></img>
<br>
</tal:block>
<a class="label label-default" href="${structure: preview_url}"
target="_blank"><i class="fa fa-search"></i> View</a>
</p>