Also conditionally render for showpaste template #1

Closed
arch wants to merge 2 commits from conditional-profile-pic into main
2 changed files with 3 additions and 3 deletions

View file

@ -12,7 +12,7 @@
<main> <main>
<nav> <nav>
<a href="/">tclip</a>{{if .UserInfo}} - <a href="/paste/list">List</a> - <a href="/help">Help</a>{{end}} <a href="/">tclip</a>{{if .UserInfo}} - <a href="/paste/list">List</a> - <a href="/help">Help</a>{{end}}
{{if .UserInfo}}<div class="right">{{.UserInfo.DisplayName}} <img style="width:32px;height:32px" src="{{.UserInfo.ProfilePicURL}}" /></div>{{end}} {{if .UserInfo}}<div class="right">{{.UserInfo.DisplayName}} {{if .UserInfo.ProfilePicURL}}<img style="width:32px;height:32px" src="{{.UserInfo.ProfilePicURL}}" />{{end}}</div>{{end}}
</nav> </nav>
<h1>{{.Title}}</h1> <h1>{{.Title}}</h1>

View file

@ -4,10 +4,10 @@
{{if .UserInfo}} {{if .UserInfo}}
{{if ne .PasterUserID .UserID}} {{if ne .PasterUserID .UserID}}
<div class="right">{{.PasterDisplayName}} <img style="width:32px;height:32px" src="{{.PasterProfilePicURL}}" /></div> <div class="right">{{.PasterDisplayName}} {{if .PasterProfilePicURL}}<img style="width:32px;height:32px" src="{{.PasterProfilePicURL}}" />{{end}}</div>
{{end}} {{end}}
{{else}} {{else}}
<div class="right">{{.PasterDisplayName}} <img style="width:32px;height:32px" src="{{.PasterProfilePicURL}}" /></div> <div class="right">{{.PasterDisplayName}} {{if .PasterProfilePicURL}}<img style="width:32px;height:32px" src="{{.PasterProfilePicURL}}" />{{end}}</div>
{{end}} {{end}}
<p>Created at {{.CreatedAt}}</p> <p>Created at {{.CreatedAt}}</p>