aboutsummaryrefslogtreecommitdiff
path: root/templates/media.qtpl
diff options
context:
space:
mode:
authorGabriel Arakaki Giovanini <mail@gabrielgio.me>2023-07-18 23:20:15 +0200
committerGabriel Arakaki Giovanini <mail@gabrielgio.me>2023-07-18 23:21:38 +0200
commit55448bc974f71f83e6a6c6d70afe9cfc63d275f4 (patch)
tree40a392a2af845ebb07ead41b2fb0d25fd40f5fb8 /templates/media.qtpl
parent8448f93e179e03d4ba46af7ae457675146f93d6b (diff)
downloadlens-55448bc974f71f83e6a6c6d70afe9cfc63d275f4.tar.gz
lens-55448bc974f71f83e6a6c6d70afe9cfc63d275f4.tar.bz2
lens-55448bc974f71f83e6a6c6d70afe9cfc63d275f4.zip
feat: Move media from `html/template` to qtpl
Diffstat (limited to 'templates/media.qtpl')
-rw-r--r--templates/media.qtpl37
1 files changed, 37 insertions, 0 deletions
diff --git a/templates/media.qtpl b/templates/media.qtpl
new file mode 100644
index 0000000..88ce582
--- /dev/null
+++ b/templates/media.qtpl
@@ -0,0 +1,37 @@
+{% import "git.sr.ht/~gabrielgio/img/pkg/database/repository" %}
+
+{% code
+type MediaPage struct {
+ Medias []*repository.Media
+ Next *repository.Pagination
+}
+%}
+
+{% func (p *MediaPage) Title() %}
+Media
+{% endfunc %}
+
+
+{% func (p *MediaPage) Content() %}
+<div class="columns is-multiline">
+{% for _, media := range p.Medias %}
+ <div class="card-image">
+ {% if media.IsVideo() %}
+ <video controls muted="true" poster="/media/thumbnail?path_hash={%s media.PathHash %}" preload="none">
+ <source src="/media/image?path_hash={%s media.PathHash %}" type="{%s media.MIMEType %}">
+ </video>
+ {% else %}
+ <figure class="image is-fit">
+ <img src="/media/thumbnail?path_hash={%s media.PathHash %}">
+ </figure>
+ {% endif %}
+ </div>
+{% endfor %}
+</div>
+<div class="row">
+ <a href="/media?page={%d p.Next.Page %}" class="button is-pulled-right">next</a>
+</div>
+{% endfunc %}
+
+{% func (p *MediaPage) Script() %}
+{% endfunc %}