lens @ c51fb8cc8b850b4915e083d0dd2c30d79f8b632e

 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">{%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">{%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 class="row">
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 %}