diff options
| author | 2023-12-05 12:43:07 +0100 | |
|---|---|---|
| committer | 2023-12-05 12:43:07 +0100 | |
| commit | dacfd413dcfc5ead5d019efbe45059f2f6922696 (patch) | |
| tree | 9b028b31d16eb90a5cf0697617e50ab1b0b7fa74 /web/template/status_attachments.tmpl | |
| parent | [chore]: Bump go.opentelemetry.io/otel/exporters/prometheus (#2412) (diff) | |
| download | gotosocial-dacfd413dcfc5ead5d019efbe45059f2f6922696.tar.xz | |
[chore/frontend] Refactor status templates slightly, put polls behind CWs if present (#2419)
* [chore/frontend] Reorder templates, allow polls to be inside content warnings
* show when multiple-choice
Diffstat (limited to 'web/template/status_attachments.tmpl')
| -rw-r--r-- | web/template/status_attachments.tmpl | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/web/template/status_attachments.tmpl b/web/template/status_attachments.tmpl new file mode 100644 index 000000000..bd26c82a6 --- /dev/null +++ b/web/template/status_attachments.tmpl @@ -0,0 +1,94 @@ +{{- /* +// 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 <http://www.gnu.org/licenses/>. +*/ -}} + +{{- /* + Template for rendering a gallery of status media attachments. + To use this template, pass a web view status into it. +*/ -}} + +{{ with .MediaAttachments }} + <div class="media photoswipe-gallery {{ (len .) | oddOrEven }} {{ if eq (len .) 1 }}single{{ else if eq (len .) 2 }}double{{- end -}}"> + {{- range $index, $media := . }} + <div class="media-wrapper"> + <details class="{{- $media.Type -}}-spoiler media-spoiler" {{- if not $media.Sensitive }} open{{ end -}}> + <summary> + <div class="show sensitive button" aria-hidden="true">Show sensitive media</div> + <span class="eye button" role="button" tabindex="0" aria-label="Toggle media"> + <i class="hide fa fa-fw fa-eye-slash" aria-hidden="true"></i> + <i class="show fa fa-fw fa-eye" aria-hidden="true"></i> + </span> + {{- if eq .Type "video" }} + <video {{- if .Description }} title="{{- $media.Description -}}" {{- end -}}> + <source type="video/mp4" src="{{- $media.URL -}}"/> + </video> + {{- else if eq .Type "image" }} + <img src="{{- $media.PreviewURL -}}" {{- if .Description }} title="{{- $media.Description -}}" {{- end }}/> + {{- end }} + </summary> + {{- if eq .Type "video" }} + <video + class="plyr-video photoswipe-slide" + controls + data-pswp-index="{{- $index -}}" + data-pswp-width="{{- $media.Meta.Original.Width -}}px" + data-pswp-height="{{- $media.Meta.Original.Height -}}px" + {{- if .Description }} + alt="{{- $media.Description -}}" + title="{{- $media.Description -}}" + {{- end }} + > + <source type="video/mp4" src="{{- $media.URL -}}"/> + </video> + {{- else if eq .Type "image" }} + <a + class="photoswipe-slide" + href="{{- $media.URL -}}" + target="_blank" + data-pswp-width="{{- $media.Meta.Original.Width -}}px" + data-pswp-height="{{- $media.Meta.Original.Height -}}px" + data-cropped="true" + {{- if .Description }} + title="{{- $media.Description -}}" + {{- end }} + > + <img src="{{$media.PreviewURL}}" {{if .Description}}alt="{{$media.Description}}" {{end}} /> + </a> + {{- else }} + <a + class="unknown-attachment" + href="{{- $media.RemoteURL -}}" + target="_blank" + {{- if .Description }} + title="Link to external media: {{ $media.Description -}} {{- $media.RemoteURL -}}" + {{- else }} + title="Link to external media. {{- $media.RemoteURL -}}" + {{- end }} + > + <div class="placeholder" aria-hidden="true"> + <i class="placeholder-external-link fa fa-external-link"></i> + <i class="placeholder-icon fa fa-file-text"></i> + <div class="placeholder-link-to">External media</div> + </div> + </a> + {{- end }} + </details> + </div> + {{- end }} + </div> +{{- end }} |
