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