lens @ 969b7600a86185187cd17d45bd252143db4a6728

 1{% import "git.sr.ht/~gabrielgio/img/pkg/database/repository" %}
 2
 3{% code
 4type AlbumPage struct {
 5	Medias   []*repository.Media
 6	Next     *repository.Pagination
 7	Settings *repository.Settings
 8	Albums   []*repository.Album
 9    Name     string
10}
11
12func (m *AlbumPage) PreloadAttr() string {
13    if m.Settings.PreloadVideoMetadata {
14        return "metadata"
15    }
16    return "none"
17}
18%}
19
20{% func (p *AlbumPage) Title() %}Media{% endfunc %}
21
22{% func (p *AlbumPage) Content() %}
23<h1 class="title text-size-1">{%s p.Name %}</h1>
24<div class="tags are-large">
25{% for _, a := range p.Albums %}
26  <a href="/album/?albumId={%s FromUInttoString(&a.ID) %}" class="tag text-size-2">{%s a.Name %}</a>
27{% endfor %}
28</div>
29<div class="columns is-multiline">
30{% for _, media := range p.Medias %}
31    <div class="card-image">
32       {% if media.IsVideo() %}
33       <video class="image is-fit" controls muted="true" poster="/media/thumbnail/?path_hash={%s media.PathHash %}" preload="{%s p.PreloadAttr() %}">
34           <source src="/media/image/?path_hash={%s media.PathHash %}" type="{%s media.MIMEType %}">
35       </video>
36       {% else %}
37        <figure class="image is-fit">
38            <img src="/media/thumbnail/?path_hash={%s media.PathHash %}">
39        </figure>
40        {% endif %}
41    </div>
42{% endfor %}
43</div>
44<div>
45    <a href="/media/?page={%d p.Next.Page %}" class="button is-pulled-right">next</a>
46</div>
47{% endfunc %}
48
49{% func (p *AlbumPage) Script() %}
50{% endfunc %}