bloat/templates/postcontent.tmpl

102 lines
3.8 KiB
Cheetah

{{ with $s := .Data }}
{{StatusContentFilter .Content .Emojis .Mentions}}
{{if .MediaAttachments}}
<div class="status-media-container">
{{range .MediaAttachments}}
{{if eq .Type "image"}}
{{if $.Ctx.HideAttachments}}
<a href="{{.URL}}" target="_blank">
{{if .Description}}[{{.Description}}]{{else}}[image]{{end}}
</a>
{{else}}
<a class="img-link" href="{{.URL}}" target="_blank" title="{{.Description}}">
<img class="status-image" src="{{.URL}}" alt="status-image" height="240" />
{{if (and $.Ctx.MaskNSFW $s.Sensitive)}}
<div class="status-nsfw-overlay"></div>
{{end}}
</a>
{{end}}
{{else if eq .Type "audio"}}
{{if $.Ctx.HideAttachments}}
<a href="{{.URL}}" target="_blank">
{{if .Description}}[{{.Description}}]{{else}}[audio]{{end}}
</a>
{{else}}
<audio class="status-audio" controls title="{{.Description}}">
<source src="{{.URL}}">
<a href="{{.URL}}" target="_blank"> [audio] </a>
</audio>
{{end}}
{{else if eq .Type "video"}}
{{if $.Ctx.HideAttachments}}
<a href="{{.URL}}" target="_blank">
{{if .Description}}[{{.Description}}]{{else}}[video]{{end}}
</a>
{{else}}
<div class="status-video-container" title="{{.Description}}">
<video class="status-video" controls height="240">
<source src="{{.URL}}">
<a href="{{.URL}}" target="_blank"> [video] </a>
</video>
{{if (and $.Ctx.MaskNSFW $s.Sensitive)}}
<div class="status-nsfw-overlay"></div>
{{end}}
</div>
{{end}}
{{else}}
<a href="{{.URL}}" target="_blank">
{{if .Description}}[{{.Description}}]{{else}}[attachment]{{end}}
</a>
{{end}}
{{end}}
</div>
{{end}}
{{if .Poll}}
<!-- lol does any of this work -->
<form class="poll-form" action="/vote/{{.Poll.ID}}" method="POST" target="_self">
<input type="hidden" name="csrf_token" value="{{$.Ctx.CSRFToken}}">
<input type="hidden" name="referrer" value="{{$.Ctx.Referrer}}">
<input type="hidden" name="status_id" value="{{$s.ID}}">
{{range $i, $o := .Poll.Options}}
<div class="poll-option">
{{if (or $s.Poll.Expired $s.Poll.Voted)}}
<div> {{EmojiFilter $o.Title $s.Emojis}} - {{$o.VotesCount}} votes </div>
{{else}}
<input type="{{if $s.Poll.Multiple}}checkbox{{else}}radio{{end}}" name="choices"
id="poll-{{$s.ID}}-{{$i}}" value="{{$i}}">
<label for="poll-{{$s.ID}}-{{$i}}">
{{EmojiFilter $o.Title $s.Emojis}}
</label>
{{end}}
</div>
{{end}}
{{if not (or .Poll.Expired .Poll.Voted)}}
<button type="submit"> Vote </button>
{{end}}
<div class="poll-info">
<span>{{.Poll.VotesCount}} votes</span>
{{if .Poll.Expired}}
<span> - poll expired </span>
{{else if .Poll.ExpiresAt}}
<span>
- poll ends in
<time datetime="{{FormatTimeRFC3339 .Poll.ExpiresAt}}" title="{{FormatTimeRFC822 .Poll.ExpiresAt}}">
{{TimeUntil .Poll.ExpiresAt}}
</time>
</span>
{{end}}
</div>
</form>
{{end}}
{{ end }}