show chatter attachments
Ted Unangst tedu@tedunangst.com
Thu, 14 May 2020 23:58:49 -0400
1 files changed,
21 insertions(+),
0 deletions(-)
jump to
M
views/chatter.html
→
views/chatter.html
@@ -26,6 +26,27 @@ <div class="chat">
<p> <span class="chatstamp">{{ .Date.Local.Format "15:04" }} {{ .Handle }}:</span> {{ .HTML }} +{{ range .Donks }} +{{ if .Local }} +{{ if eq .Media "text/plain" }} +<p><a href="/d/{{ .XID }}">Attachment: {{ .Name }}</a>{{ if not (eq .Desc .Name) }} {{ .Desc }}{{ end }} +{{ else if eq .Media "application/pdf" }} +<p><a href="/d/{{ .XID }}">Attachment: {{ .Name }}</a>{{ if not (eq .Desc .Name) }} {{ .Desc }}{{ end }} +{{ else }} +<p><img src="/d/{{ .XID }}" title="{{ .Desc }}" alt="{{ .Desc }}"> +{{ end }} +{{ else }} +{{ if .XID }} +<p><a href="{{ .URL }}" rel=noreferrer>External Attachment: {{ .Name }}</a>{{ if not (eq .Desc .Name) }} {{ .Desc }}{{ end }} +{{ else }} +{{ if eq .Media "video/mp4" }} +<p><video controls src="{{ .URL }}">{{ .Name }}</video> +{{ else }} +<p><img src="{{ .URL }}" title="{{ .Desc }}" alt="{{ .Desc }}"> +{{ end }} +{{ end }} +{{ end }} +{{ end }} </div> {{ end }} <form action="/sendchonk" method="POST">