aboutsummaryrefslogtreecommitdiff
path: root/templates/mosaic.qtpl
blob: 21a8bae9560e8e3c9b07bfd4aa75a66ec2465360 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
{% 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">
       <a href="/detail?path_hash={%s media.PathHash %}">
       {% 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>
       </a>
        {% endif %}
    </div>
    {% endfor %}
    </div>
{% endfor %}
</div>
{% endfunc %}