lens @ 752ee7db471f3d5368f30a5841d5286465a8d5ab

 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	Settings *repository.Settings
 8}
 9
10func (m *MediaPage) PreloadAttr() string {
11    if m.Settings.PreloadVideoMetadata {
12        return "metadata"
13    }
14    return "none"
15}
16%}
17
18{% func (p *MediaPage) Title() %}Media{% endfunc %}
19
20{% func (p *MediaPage) Content() %}
21<div class="columns">
22{%= Mosaic(p.Medias, p.PreloadAttr()) %}
23</div>
24<div>
25    <a href="/media/?page={%d p.Next.Page %}" class="button is-pulled-right">next</a>
26</div>
27{% endfunc %}
28
29{% func (p *MediaPage) Script() %}
30{% endfunc %}