aboutsummaryrefslogtreecommitdiff
path: root/templates/mosaic.qtpl
blob: 3e6ccf86d9ac5359d8a2a097af4269589af25fb7 (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
{% 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 %}