1{% import "git.sr.ht/~gabrielgio/img/pkg/database/repository" %}
2
3{% code
4type DetailPage struct {
5 Media *repository.Media
6 Settings *repository.Settings
7}
8
9func (m *DetailPage) PreloadAttr() string {
10 if m.Settings.PreloadVideoMetadata {
11 return "metadata"
12 }
13 return "none"
14}
15%}
16
17{% func (p *DetailPage) Title() %}Media{% endfunc %}
18
19{% func (p *DetailPage) Content() %}
20<div class="card-image">
21 {% if p.Media.IsVideo() %}
22 <video class="image is-fit" controls muted="true" poster="/media/thumbnail?path_hash={%s p.Media.PathHash %}" preload="{%s p.PreloadAttr() %}">
23 <source src="/media/image?path_hash={%s p.Media.PathHash %}" type="{%s p.Media.MIMEType %}">
24 </video>
25 {% else %}
26 <figure class="image is-fit">
27 <img src="/media/image?path_hash={%s p.Media.PathHash %}">
28 </figure>
29 {% endif %}
30</div>
31{% endfunc %}
32
33{% func (p *DetailPage) Script() %}
34{% endfunc %}