changeset 123:44b838bcc0d6

file/overview: display tumbnails when available
author Goffi <goffi@goffi.org>
date Wed, 14 Mar 2018 08:43:30 +0100
parents 9d95b58200df
children 11e729a7d8e9
files default/file/overview.html default/static/file.css
diffstat 2 files changed, 17 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/default/file/overview.html	Sun Mar 11 19:21:46 2018 +0100
+++ b/default/file/overview.html	Wed Mar 14 08:43:30 2018 +0100
@@ -23,7 +23,11 @@
         {% else %}
             <li class="file file_{{file.type}}">
                 <a href="{{file.url}}">
-                    {{ icon('doc', cls='file__icon icon--soft') }}
+                    {% if file.thumb_url is defined %}
+                        <img src="{{file.thumb_url}}" class="file__thumbnail" alt="{{file.name}}">
+                    {% else %}
+                        {{ icon('doc', cls='file__icon icon--soft') }}
+                    {% endif %}
                     {{ file.name }}
                 </a>
             </li>
--- a/default/static/file.css	Sun Mar 11 19:21:46 2018 +0100
+++ b/default/static/file.css	Wed Mar 14 08:43:30 2018 +0100
@@ -20,6 +20,11 @@
 
 .file a {
     text-decoration: none;
+    outline: none;
+}
+
+.file a:focus img {
+    outline: 3px solid #bbb;
 }
 
 .file__icon {
@@ -28,6 +33,13 @@
     margin: 0 auto;
 }
 
+.file__thumbnail {
+    max-width: 300px;
+    height: 125px;
+    display: block;
+    margin: 0 auto;
+}
+
 .icon--soft {
     fill: #777;
 }