Commit c0d3b361 by aa.gusti

perbaikan file_upload widget

1 parent 99aad6a3
...@@ -14,7 +14,8 @@ ${field.start_mapping()} ...@@ -14,7 +14,8 @@ ${field.start_mapping()}
style="${style}" style="${style}"
onload="window.URL.revokeObjectURL(this.src);"></img> onload="window.URL.revokeObjectURL(this.src);"></img>
<video tal:condition="ext in video" style="${style}" controls <video tal:condition="ext in video" style="${style}" controls
src="${preview_url}" type="video/${ext}"> src="${preview_url}" type="video/${ext}"
id="preview-${oid}">
Your browser does not support the video tag. Your browser does not support the video tag.
</video> </video>
...@@ -23,14 +24,16 @@ ${field.start_mapping()} ...@@ -23,14 +24,16 @@ ${field.start_mapping()}
controls controls
style="${style}" style="${style}"
src="${preview_url}" src="${preview_url}"
type="video/mp4"> type="video/mp4"
id="preview-${oid}">
Your browser does not support the video tag. Your browser does not support the video tag.
</video> </video>
<embed tal:condition="ext=='pdf'" src="${preview_url}" style="${style}"> <embed tal:condition="ext=='pdf'" src="${preview_url}" style="${style}"
id="preview-${oid}">
<a id="label-${oid}" tal:condition="preview_url" class="label label-default" href="${preview_url}" <a class="label label-default" href="${preview_url}"
target="_blank"><i class="fa fa-search"></i> View</a> target="_blank" id="a-preview-${oid}"><i class="fa fa-search"></i> View</a>
<input type="file" name="upload" id="${oid}" <input type="file" name="upload" id="${oid}"
tal:attributes="style style; tal:attributes="style style;
......
...@@ -6,14 +6,17 @@ ...@@ -6,14 +6,17 @@
fname str(cstruct.get('filename'))|''; fname str(cstruct.get('filename'))|'';
delete cstruct.get('delete')|''; delete cstruct.get('delete')|'';
ext str(cstruct.get('filename').split('.')[-1:][0]).lower()|[]; ext str(cstruct.get('filename').split('.')[-1:][0]).lower()|[];
oid oid|field.oid;
img ['jpg', 'jpeg', 'gif', 'png', 'svg', 'eps', 'psd']; img ['jpg', 'jpeg', 'gif', 'png', 'svg', 'eps', 'psd'];
video ['avi', 'mov', 'mpv']; video ['avi', 'mov', 'mpv'];
"> ">
<img tal:condition="ext in img" id="preview-${oid}" alt="" src="${preview_url}" <img tal:condition="ext in img" id="preview-${oid}" alt="" src="${preview_url}"
style="${style}" style="${style}"
onload="window.URL.revokeObjectURL(this.src);"></img> onload="window.URL.revokeObjectURL(this.src);"></img>
<video tal:condition="ext in video" style="${style}" controls <video tal:condition="ext in video"
src="${preview_url}" type="video/${ext}"> style="${style}" controls
src="${preview_url}" type="video/${ext}"
id="preview-${oid}">
Your browser does not support the video tag. Your browser does not support the video tag.
</video> </video>
...@@ -22,16 +25,17 @@ ...@@ -22,16 +25,17 @@
controls controls
style="${style}" style="${style}"
src="${preview_url}" src="${preview_url}"
type="video/mp4"> type="video/mp4"
id="preview-${oid}">
Your browser does not support the video tag. Your browser does not support the video tag.
</video> </video>
<embed tal:condition="ext=='pdf'" src="${preview_url}" style="${style}"> <embed tal:condition="ext=='pdf'" src="${preview_url}" style="${style}" id="preview-${oid}">
<tal:block tal:condition="preview_url and ext in ['jpg','jpeg','png','bmp','gif']"> <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> <img src="${structure: preview_url}" style="width:100px;height:auto;"></img>
<br> <br>
</tal:block> </tal:block>
<a class="label label-default" href="${structure: preview_url}" <a id="a-preview-${oid}" class="label label-default" href="${structure: preview_url}"
target="_blank"><i class="fa fa-search"></i> View</a> target="_blank" ><i class="fa fa-search"></i> View</a>
</p> </p>
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!