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