when omit images, include a link

This commit is contained in:
Ted Unangst 2020-05-08 16:15:06 -04:00
parent 9f60cb8058
commit 21baa9eaaa
4 changed files with 9 additions and 4 deletions

View File

@ -2,6 +2,8 @@ changelog
=== next === next
+ Much better omit images handling.
+ Fix update activity. + Fix update activity.
+ A few API refinements and additions. + A few API refinements and additions.

View File

@ -2,6 +2,7 @@
{{ $bonkcsrf := .BonkCSRF }} {{ $bonkcsrf := .BonkCSRF }}
{{ $IsPreview := .IsPreview }} {{ $IsPreview := .IsPreview }}
{{ $maplink := .MapLink }} {{ $maplink := .MapLink }}
{{ $omitimages := .OmitImages }}
{{ with .Honk }} {{ with .Honk }}
<header> <header>
{{ if $bonkcsrf }} {{ if $bonkcsrf }}
@ -70,8 +71,12 @@ in reply to: <a href="{{ .RID }}" rel=noreferrer>{{ .RID }}</a>
{{ else if eq .Media "application/pdf" }} {{ else if eq .Media "application/pdf" }}
<p><a href="/d/{{ .XID }}">Attachment: {{ .Name }}</a>{{ if not (eq .Desc .Name) }} {{ .Desc }}{{ end }} <p><a href="/d/{{ .XID }}">Attachment: {{ .Name }}</a>{{ if not (eq .Desc .Name) }} {{ .Desc }}{{ end }}
{{ else }} {{ else }}
{{ if $omitimages }}
<p><a href="/d/{{ .XID }}">Image: {{ .Name }}</a>{{ if not (eq .Desc .Name) }} {{ .Desc }}{{ end }}
{{ else }}
<p><img src="/d/{{ .XID }}" title="{{ .Desc }}" alt="{{ .Desc }}"> <p><img src="/d/{{ .XID }}" title="{{ .Desc }}" alt="{{ .Desc }}">
{{ end }} {{ end }}
{{ end }}
{{ else }} {{ else }}
{{ if .XID }} {{ if .XID }}
<p><a href="{{ .URL }}" rel=noreferrer>External Attachment: {{ .Name }}</a>{{ if not (eq .Desc .Name) }} {{ .Desc }}{{ end }} <p><a href="{{ .URL }}" rel=noreferrer>External Attachment: {{ .Name }}</a>{{ if not (eq .Desc .Name) }} {{ .Desc }}{{ end }}

View File

@ -35,8 +35,9 @@ servermsgs[curpagestate.name + ":" + curpagestate.arg] = "{{ .ServerMessage }}"
{{ $IsPreview := .IsPreview }} {{ $IsPreview := .IsPreview }}
{{ $MapLink := .MapLink }} {{ $MapLink := .MapLink }}
{{ $Badonk := .User.Options.Reaction }} {{ $Badonk := .User.Options.Reaction }}
{{ $OmitImages := .User.Options.OmitImages }}
{{ range .Honks }} {{ range .Honks }}
{{ template "honk.html" map "Honk" . "MapLink" $MapLink "BonkCSRF" $BonkCSRF "IsPreview" $IsPreview "Badonk" $Badonk }} {{ template "honk.html" map "Honk" . "MapLink" $MapLink "BonkCSRF" $BonkCSRF "IsPreview" $IsPreview "Badonk" $Badonk "OmitImages" $OmitImages }}
{{ end }} {{ end }}
</div> </div>
</div> </div>

3
web.go
View File

@ -59,9 +59,6 @@ func getuserstyle(u *login.UserInfo) template.CSS {
if user.Options.SkinnyCSS { if user.Options.SkinnyCSS {
css += "main { max-width: 700px; }\n" css += "main { max-width: 700px; }\n"
} }
if user.Options.OmitImages {
css += ".honk .noise img { display: none; }\n"
}
return css return css
} }