diff options
| author | 2025-03-26 16:59:39 +0100 | |
|---|---|---|
| committer | 2025-03-26 15:59:39 +0000 | |
| commit | b6e481d63eec15191f2717957682c13ee8a68308 (patch) | |
| tree | 03cb9fc8bcb5f9eefddee754ad64b9de10c44c39 /web/template/status.tmpl | |
| parent | [chore] bumps our spf13/viper version (#3943) (diff) | |
| download | gotosocial-b6e481d63eec15191f2717957682c13ee8a68308.tar.xz | |
[feature] Allow user to choose "gallery" style layout for web view of profile (#3917)
* [feature] Allow user to choose "gallery" style web layout
* find a bug and squish it up and all day long you'll have good luck
* just a sec
* [performance] reindex public timeline + tinker with query a bit
* fiddling
* should be good now
* last bit of finagling, i'm done now i prommy
* panic normally
Diffstat (limited to 'web/template/status.tmpl')
| -rw-r--r-- | web/template/status.tmpl | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/web/template/status.tmpl b/web/template/status.tmpl index 85000fd72..872b784ed 100644 --- a/web/template/status.tmpl +++ b/web/template/status.tmpl @@ -30,6 +30,16 @@ it in an appropriate <article></article>! */ -}} +{{- /* Produces something like "1 attachment", "2 attachments", etc */ -}} +{{- define "attachmentsLength" -}} +{{- (len .) }}{{- if eq (len .) 1 }} attachment{{- else }} attachments{{- end -}} +{{- end -}} + +{{- /* Produces something like "media photoswipe-gallery odd single" */ -}} +{{- define "galleryClass" -}} +media photoswipe-gallery {{ (len .) | oddOrEven }} {{ if eq (len .) 1 }}single{{ else if eq (len .) 2 }}double{{ end }} +{{- end -}} + {{- with . }} <header class="status-header"> {{- include "status_header.tmpl" . | indent 1 }} @@ -63,7 +73,15 @@ </div> {{- end }} {{- if .MediaAttachments }} - {{- include "status_attachments.tmpl" . | indent 1 }} + <div + class="{{- template "galleryClass" .MediaAttachments -}}" + role="group" + aria-label="{{- template "attachmentsLength" .MediaAttachments -}}" + > + {{- range $index, $media := .MediaAttachments }} + {{- includeIndex "status_attachment.tmpl" $media $index | indent 2 }} + {{- end }} + </div> {{- end }} </div> <aside class="status-info" aria-hidden="true"> |
