lens @ d2a9e162352646e7f1550823c3d88496590f8760

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