{{- /* // GoToSocial // Copyright (C) GoToSocial Authors admin@gotosocial.org // SPDX-License-Identifier: AGPL-3.0-or-later // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . */ -}} {{- /* Template for rendering a gallery of status media attachments. To use this template, pass a web view status into it. */ -}} {{- define "imagePreview" }} {{- .Description -}} {{- end }} {{- define "videoPreview" }} {{- end }} {{- /* 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 .MediaAttachments }}
{{- range $index, $media := . }}
{{- if eq .Type "video" }} {{- include "videoPreview" $media | indent 4 }} {{- else if eq .Type "image" }} {{- include "imagePreview" $media | indent 4 }} {{- end }} {{- if eq .Type "video" }} {{- else if eq .Type "image" }} {{- with $media }} {{- include "imagePreview" . | indent 4 }} {{- end }} {{- else }} {{- end }}
{{- end }}
{{- end }}