aboutsummaryrefslogtreecommitdiff
path: root/templates/media.qtpl
blob: 88ce5820e3813ff1962f1ab3d4d06e311cebd231 (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
27
28
29
30
31
32
33
34
35
36
37
{% import "git.sr.ht/~gabrielgio/img/pkg/database/repository" %}

{% code
type MediaPage struct {
	Medias []*repository.Media
	Next   *repository.Pagination
}
%}

{% func (p *MediaPage) Title() %}
Media
{% endfunc %}


{% func (p *MediaPage) Content() %}
<div class="columns is-multiline">
{% for _, media := range p.Medias %}
    <div class="card-image">
       {% if media.IsVideo() %}
       <video controls muted="true" poster="/media/thumbnail?path_hash={%s media.PathHash %}" preload="none">
           <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>
<div class="row">
    <a href="/media?page={%d p.Next.Page %}" class="button is-pulled-right">next</a>
</div>
{% endfunc %}

{% func (p *MediaPage) Script() %}
{% endfunc %}