--- a/src/pyams_file/widget/templates/media-display.pt Mon Aug 27 11:05:02 2018 +0200
+++ b/src/pyams_file/widget/templates/media-display.pt Mon Aug 27 11:05:37 2018 +0200
@@ -2,20 +2,38 @@
<div class="current-value"
tal:define="value view/current_value"
tal:condition="value">
- <a class="fancybox hint pull-left margin-left-5 margin-right-10" data-toggle
- data-ams-fancybox-type="image"
- data-ams-hint-gravity="e"
- data-ams-hint-offset="5"
- tal:define="thumbnails tales:thumbnails(value);
- target python:thumbnails.get_thumbnail('800x600', 'jpeg');"
- tal:attributes="href tales:absolute_url(target);"
- title="Zoom image" i18n:attributes="title">
- <img class="thumbnail" title="" src="" alt=""
- tal:define="thumbnail python:thumbnails.get_thumbnail('128x128');"
- tal:attributes="src string:${tales:absolute_url(thumbnail)}?_=${tales:timestamp(thumbnail)};
- title i18n:value.title;" />
- </a>
- <tal:if condition="python:value.content_type.startswith('image/')">
+ <tal:if condition="python:value.content_type.startswith('image/svg')">
+ <div tal:content="structure tales:thumbnail(value, 128, 'auto', 'pull-left margin-5 margin-right-10')">
+ Thumbnail
+ </div>
+ <div class="margin-top-5">
+ <span i18n:translate="">Current value: </span>
+ <span tal:content="value/content_type"></span>
+ –
+ <span tal:content="python:view.get_human_size(value.get_size())"></span>
+ <br />
+ <a class="btn btn-xs btn-primary" target="download_window"
+ tal:define="href tales:absolute_url(value);
+ timestamp tales:timestamp(value);"
+ tal:attributes="href string:${href}?download=1&_=${timestamp}"
+ i18n:translate="">Download</a>
+ </div>
+ </tal:if>
+ <tal:if condition="python:value.content_type.startswith('image/') and not value.content_type.startswith('image/svg')">
+ <a class="fancybox hint pull-left margin-5 margin-right-10" data-toggle
+ data-ams-fancybox-type="image"
+ data-ams-hint-gravity="e"
+ data-ams-hint-offset="5"
+ tal:define="thumbnail python:view.get_thumbnail('128x128');
+ target python:view.get_thumbnail('800x600');"
+ tal:attributes="href tales:absolute_url(target);"
+ title="Zoom image" i18n:attributes="title">
+ <img class="thumbnail" title="" src="" alt=""
+ tal:define="url tales:absolute_url(thumbnail);"
+ tal:attributes="id string:thumbnail_${tales:cache_key(value)};
+ src string:${url};
+ title i18n:value.title;" />
+ </a>
<div class="margin-top-5">
<span i18n:translate="">Current value: </span>
<span tal:content="value/content_type"></span>
@@ -25,22 +43,30 @@
<span tal:content="python:view.get_human_size(value.get_size())"></span>
<br />
<a class="btn btn-xs btn-primary" target="download_window"
- tal:define="href tales:absolute_url(value)"
- tal:attributes="href string:${href}?download=1&_=${view/timestamp}"
- i18n:translate="">
- Download
- </a>
+ tal:define="href tales:absolute_url(value);
+ timestamp tales:timestamp(value);"
+ tal:attributes="href string:${href}?download=1&_=${timestamp}"
+ i18n:translate="">Download</a>
</div>
</tal:if>
<tal:if condition="not:python:value.content_type.startswith('image/')">
+ <div class="pull-left margin-5 margin-right-10">
+ <a tal:define="target view/get_thumbnail_target"
+ tal:omit-tag="not:target"
+ tal:attributes="href target" data-toggle="modal">
+ <img class="thumbnail no-border"
+ tal:attributes="src view/get_thumbnail" />
+ </a>
+ </div>
<div class="margin-top-5">
<span i18n:translate="">Current value: </span>
<span tal:content="value/content_type"></span>
–
<span tal:content="python:view.get_human_size(value.get_size())"></span>
<a class="btn btn-xs btn-primary" target="download_window"
- tal:define="href tales:absolute_url(value)"
- tal:attributes="href string:${href}?download=1&_=${view/timestamp}"
+ tal:define="href tales:absolute_url(value)
+ timestamp tales:timestamp(value)"
+ tal:attributes="href string:${href}?download=1&_=${timestamp}"
i18n:translate="">Download</a>
</div>
</tal:if>
--- a/src/pyams_file/widget/templates/media-input.pt Mon Aug 27 11:05:02 2018 +0200
+++ b/src/pyams_file/widget/templates/media-input.pt Mon Aug 27 11:05:37 2018 +0200
@@ -39,9 +39,7 @@
tal:define="href tales:absolute_url(value);
timestamp tales:timestamp(value);"
tal:attributes="href string:${href}?download=1&_=${timestamp}"
- i18n:translate="">
- Download
- </a>
+ i18n:translate="">Download</a>
</div>
</div>
</tal:if>
@@ -78,9 +76,7 @@
tal:define="href tales:absolute_url(value);
timestamp tales:timestamp(value)"
tal:attributes="href string:${href}?download=1&_=${timestamp}"
- i18n:translate="">
- Download
- </a>
+ i18n:translate="">Download</a>
</div>
</div>
</tal:if>
@@ -106,11 +102,10 @@
content="structure viewlet/render">
</tal:loop>
<a class="btn btn-xs btn-primary" target="download_window"
- tal:define="href tales:absolute_url(value)"
- tal:attributes="href string:${href}?download=1&_=${view/timestamp}"
- i18n:translate="">
- Download
- </a>
+ tal:define="href tales:absolute_url(value);
+ timestamp tales:timestamp(value)"
+ tal:attributes="href string:${href}?download=1&_=${timestamp}"
+ i18n:translate="">Download</a>
</div>
</div>
</tal:if>