1{% import "git.sr.ht/~gabrielgio/img/pkg/database/repository" %}
2
3{% code
4type MediaPage struct {
5 Medias []*repository.Media
6 Next *repository.Pagination
7}
8%}
9
10{% func (p *MediaPage) Title() %}
11Media
12{% endfunc %}
13
14
15{% func (p *MediaPage) Content() %}
16<div class="columns is-multiline">
17{% for _, media := range p.Medias %}
18 <div class="card-image">
19 {% if media.IsVideo() %}
20 <video controls muted="true" poster="/media/thumbnail?path_hash={%s media.PathHash %}" preload="none">
21 <source src="/media/image?path_hash={%s media.PathHash %}" type="{%s media.MIMEType %}">
22 </video>
23 {% else %}
24 <figure class="image is-fit">
25 <img src="/media/thumbnail?path_hash={%s media.PathHash %}">
26 </figure>
27 {% endif %}
28 </div>
29{% endfor %}
30</div>
31<div class="row">
32 <a href="/media?page={%d p.Next.Page %}" class="button is-pulled-right">next</a>
33</div>
34{% endfunc %}
35
36{% func (p *MediaPage) Script() %}
37{% endfunc %}