From 44ca9a290eb555f07d1b677f88d25cabe7d7eed9 Mon Sep 17 00:00:00 2001 From: alyssa Date: Wed, 24 Mar 2021 01:19:47 +0000 Subject: [PATCH] put other post content behind spoiler --- templates/postcontent.tmpl | 102 +++++++++++++++++++++++++++++++++++++ templates/status.tmpl | 95 +--------------------------------- 2 files changed, 104 insertions(+), 93 deletions(-) create mode 100644 templates/postcontent.tmpl diff --git a/templates/postcontent.tmpl b/templates/postcontent.tmpl new file mode 100644 index 0000000..63c7b85 --- /dev/null +++ b/templates/postcontent.tmpl @@ -0,0 +1,102 @@ +{{ with $s := .Data }} + + {{StatusContentFilter .Content .Emojis .Mentions}} + + {{if .MediaAttachments}} +
+ {{range .MediaAttachments}} + + {{if eq .Type "image"}} + + {{if $.Ctx.HideAttachments}} + + {{if .Description}}[{{.Description}}]{{else}}[image]{{end}} + + {{else}} + + status-image + {{if (and $.Ctx.MaskNSFW $s.Sensitive)}} +
+ {{end}} +
+ {{end}} + + {{else if eq .Type "audio"}} + + {{if $.Ctx.HideAttachments}} + + {{if .Description}}[{{.Description}}]{{else}}[audio]{{end}} + + {{else}} + + {{end}} + + {{else if eq .Type "video"}} + + {{if $.Ctx.HideAttachments}} + + {{if .Description}}[{{.Description}}]{{else}}[video]{{end}} + + {{else}} +
+ + {{if (and $.Ctx.MaskNSFW $s.Sensitive)}} +
+ {{end}} +
+ {{end}} + + {{else}} + + {{if .Description}}[{{.Description}}]{{else}}[attachment]{{end}} + + {{end}} + {{end}} +
+ {{end}} + + {{if .Poll}} + +
+ + + + {{range $i, $o := .Poll.Options}} +
+ {{if (or $s.Poll.Expired $s.Poll.Voted)}} +
{{EmojiFilter $o.Title $s.Emojis}} - {{$o.VotesCount}} votes
+ {{else}} + + + {{end}} +
+ {{end}} + {{if not (or .Poll.Expired .Poll.Voted)}} + + {{end}} +
+ {{.Poll.VotesCount}} votes + {{if .Poll.Expired}} + - poll expired + {{else if .Poll.ExpiresAt}} + + - poll ends in + + + {{end}} +
+
+ {{end}} + +{{ end }} \ No newline at end of file diff --git a/templates/status.tmpl b/templates/status.tmpl index 1ba1dda..966309e 100644 --- a/templates/status.tmpl +++ b/templates/status.tmpl @@ -91,103 +91,12 @@ {{if .SpoilerText}}
{{.SpoilerText}} - {{StatusContentFilter .Content .Emojis .Mentions}} + {{template "postcontent.tmpl" (WithContext $s $.Ctx)}}
{{else}} - {{StatusContentFilter .Content .Emojis .Mentions}} + {{template "postcontent.tmpl" (WithContext $s $.Ctx)}} {{end}} {{end}} - {{if .MediaAttachments}} -
- {{range .MediaAttachments}} - - {{if eq .Type "image"}} - {{if $.Ctx.HideAttachments}} - - {{if .Description}}[{{.Description}}]{{else}}[image]{{end}} - - {{else}} - - status-image - {{if (and $.Ctx.MaskNSFW $s.Sensitive)}} -
- {{end}} -
- {{end}} - - {{else if eq .Type "audio"}} - {{if $.Ctx.HideAttachments}} - - {{if .Description}}[{{.Description}}]{{else}}[audio]{{end}} - - {{else}} - - {{end}} - - {{else if eq .Type "video"}} - {{if $.Ctx.HideAttachments}} - - {{if .Description}}[{{.Description}}]{{else}}[video]{{end}} - - {{else}} -
- - {{if (and $.Ctx.MaskNSFW $s.Sensitive)}} -
- {{end}} -
- {{end}} - - {{else}} - - {{if .Description}}[{{.Description}}]{{else}}[attachment]{{end}} - - {{end}} - {{end}} -
- {{end}} - {{if .Poll}} -
- - - - {{range $i, $o := .Poll.Options}} -
- {{if (or $s.Poll.Expired $s.Poll.Voted)}} -
{{EmojiFilter $o.Title $s.Emojis}} - {{$o.VotesCount}} votes
- {{else}} - - - {{end}} -
- {{end}} - {{if not (or .Poll.Expired .Poll.Voted)}} - - {{end}} -
- {{.Poll.VotesCount}} votes - {{if .Poll.Expired}} - - poll expired - {{else if .Poll.ExpiresAt}} - - - poll ends in - - - {{end}} -
-
- {{end}}