From 9efb11d8485f8273f7d64d46f2675a78fc41d6e8 Mon Sep 17 00:00:00 2001 From: tobi <31960611+tsmethurst@users.noreply.github.com> Date: Mon, 15 Jul 2024 11:47:57 +0200 Subject: [feature/frontend] Add player for audio files; use thumbnail for `poster` (#3099) * [feature/frontend] Audio player for audio media types * use video preview images for previews instead of video itself * don't preload * update tests for new zork status * collapse media gallery into single row when small --- web/template/status_attachments.tmpl | 70 +++++++++++++++++++++++++++++++----- 1 file changed, 61 insertions(+), 9 deletions(-) (limited to 'web/template') diff --git a/web/template/status_attachments.tmpl b/web/template/status_attachments.tmpl index b257f2211..5df3d1c5c 100644 --- a/web/template/status_attachments.tmpl +++ b/web/template/status_attachments.tmpl @@ -36,16 +36,42 @@ {{- end }} {{- define "videoPreview" }} - + width="{{- .Meta.Small.Width -}}" + height="{{- .Meta.Small.Height -}}" +/> +{{- end }} + +{{- define "audioPreview" }} +{{- if and .PreviewURL .Meta.Small.Width }} +{{- .Description -}} +{{- else }} +{{- .Description -}} +{{- end }} {{- end }} {{- /* Produces something like "1 attachment", "2 attachments", etc */ -}} @@ -77,21 +103,47 @@ media photoswipe-gallery {{ (len .) | oddOrEven }} {{ if eq (len .) 1 }}single{{ {{- include "videoPreview" $media | indent 4 }} {{- else if eq .Type "image" }} {{- include "imagePreview" $media | indent 4 }} + {{- else if eq .Type "audio" }} + {{- include "audioPreview" $media | indent 4 }} {{- end }} {{- if eq .Type "video" }} + {{- else if eq .Type "audio" }} + {{- else if eq .Type "image" }}