Commit de32e5c8 by iWan Mustaqim

File Upload PDF

1 parent 6a8fa480
...@@ -7,7 +7,8 @@ ...@@ -7,7 +7,8 @@
delete cstruct.get('delete')|''; delete cstruct.get('delete')|'';
maxsize field.widget.size|5242880; maxsize field.widget.size|5242880;
img ['jpg', 'jpeg', 'gif', 'png', 'svg', 'eps', 'psd']; img ['jpg', 'jpeg', 'gif', 'png', 'svg', 'eps', 'psd'];
video ['avi', 'mov', 'mpv'] video ['avi', 'mov', 'mpv'];
pdf ['pdf'];
"> ">
${field.start_mapping()} ${field.start_mapping()}
<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}"
...@@ -18,7 +19,7 @@ ${field.start_mapping()} ...@@ -18,7 +19,7 @@ ${field.start_mapping()}
Your browser does not support the video tag. Your browser does not support the video tag.
</video> </video>
<!-- Preview Video -->
<video tal:condition="ext=='mp4'" <video tal:condition="ext=='mp4'"
controls controls
style="${style}" style="${style}"
...@@ -27,7 +28,18 @@ ${field.start_mapping()} ...@@ -27,7 +28,18 @@ ${field.start_mapping()}
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}"> <!-- Preview PDF -->
<tal:block tal:condition="ext in pdf">
<embed id="preview-${oid}"
src="${preview_url}"
type="application/pdf"
width="100%"
height="600px"
style="${style or 'border:1px solid #ddd;border-radius:4px;'}" />
<p>
<a href="${preview_url}" target="_blank">Buka PDF di tab baru</a>
</p>
</tal:block>
<a id="label-${oid}" tal:condition="preview_url" class="label label-default" href="${preview_url}" <a id="label-${oid}" tal:condition="preview_url" class="label label-default" href="${preview_url}"
target="_blank"><i class="fa fa-search"></i> View</a> target="_blank"><i class="fa fa-search"></i> View</a>
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
ext str(cstruct.get('filename').split('.')[-1:][0]).lower()|[]; ext str(cstruct.get('filename').split('.')[-1:][0]).lower()|[];
img ['jpg', 'jpeg', 'gif', 'png', 'svg', 'eps', 'psd']; img ['jpg', 'jpeg', 'gif', 'png', 'svg', 'eps', 'psd'];
video ['avi', 'mov', 'mpv']; video ['avi', 'mov', 'mpv'];
pdf ['pdf'];
"> ">
<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}"
...@@ -17,7 +18,7 @@ ...@@ -17,7 +18,7 @@
Your browser does not support the video tag. Your browser does not support the video tag.
</video> </video>
<!-- Preview Video -->
<video tal:condition="ext=='mp4'" <video tal:condition="ext=='mp4'"
controls controls
style="${style}" style="${style}"
...@@ -26,7 +27,17 @@ ...@@ -26,7 +27,17 @@
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}"> <!-- Preview PDF -->
<tal:block tal:condition="ext in pdf">
<embed src="${preview_url}"
type="application/pdf"
width="100%"
height="600px"
style="${style or 'border:1px solid #ddd;border-radius:4px;'}" />
<p>
<a href="${preview_url}" target="_blank">Buka PDF di tab baru</a>
</p>
</tal:block>
<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>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!