aboutsummaryrefslogtreecommitdiff
path: root/templates/mosaic.qtpl
diff options
context:
space:
mode:
Diffstat (limited to 'templates/mosaic.qtpl')
-rw-r--r--templates/mosaic.qtpl24
1 files changed, 24 insertions, 0 deletions
diff --git a/templates/mosaic.qtpl b/templates/mosaic.qtpl
new file mode 100644
index 0000000..18dbcba
--- /dev/null
+++ b/templates/mosaic.qtpl
@@ -0,0 +1,24 @@
+{% import "git.sr.ht/~gabrielgio/img/pkg/database/repository" %}
+{% import "git.sr.ht/~gabrielgio/img/pkg/list" %}
+
+{% func Mosaic(medias []*repository.Media, preloadAttr string) %}
+<div class="columns">
+{% for _, c := range list.Distribuite(medias, 6) %}
+ <div class="column is-2">
+ {% for _, media := range c %}
+ <div class="card-image">
+ {% if media.IsVideo() %}
+ <video class="image is-fit" controls muted="true" poster="/media/thumbnail?path_hash={%s media.PathHash %}" preload="{%s preloadAttr %}">
+ <source src="/media/image?path_hash={%s media.PathHash %}" type="{%s media.MIMEType %}">
+ </video>
+ {% else %}
+ <figure class="image is-fit">
+ <img src="/media/thumbnail?path_hash={%s media.PathHash %}">
+ </figure>
+ {% endif %}
+ </div>
+ {% endfor %}
+ </div>
+{% endfor %}
+</div>
+{% endfunc %}