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{% func (p *MediaPage) Content() %}
15<div class="columns is-multiline">
16{% for _, media := range p.Medias %}
17 <div class="card-image">
18 {% if media.IsVideo() %}
19 <video controls muted="true" poster="/media/thumbnail?path_hash={%s media.PathHash %}" preload="none">
20 <source src="/media/image?path_hash={%s media.PathHash %}" type="{%s media.MIMEType %}">
21 </video>
22 {% else %}
23 <figure class="image is-fit">
24 <img src="/media/thumbnail?path_hash={%s media.PathHash %}">
25 </figure>
26 {% endif %}
27 </div>
28{% endfor %}
29</div>
30<div class="row">
31 <a href="/media?page={%d p.Next.Page %}" class="button is-pulled-right">next</a>
32</div>
33{% endfunc %}
34
35{% func (p *MediaPage) Script() %}
36{% endfunc %}