lishwist/templates/foreign_wishlist.gotmpl

45 lines
1.4 KiB
Go Template

{{define "body"}}
<h1>Lishwist</h1>
<nav>
<ul>
<li>
<a href="/">Home</a>
</li>
</ul>
</nav>
<h2>{{.Username}}'s list</h2>
<form method="post" action="/{{.UserReference}}/update" autocomplete="off"
onchange="const checked = someChecked(this.unclaimed) || someChecked(this.claimed); this.mode[0].disabled = !checked; this.mode[1].disabled = !checked;">
<button type="submit" name="mode" value="claim" disabled>Claim/Unclaim</button>
<button type="submit" name="mode" value="complete" disabled>Complete</button>
<ul>
{{range .Gifts}}
<li>
<label>
{{if .ClaimantId}}
{{if eq .ClaimantId $.CurrentUserId}}
<input type="checkbox" name="claimed" value="{{.Id}}" {{if .Sent}}disabled{{end}}>
{{else}}
<input type="checkbox" disabled>
{{end}}
{{else}}
<input type="checkbox" name="unclaimed" value="{{.Id}}" {{if .Sent}}disabled{{end}}>
{{end}}
{{if .Sent}}
<s>{{.Name}}</s>
{{else}}
{{.Name}}
{{end}}
{{if .ClaimantId}}
{{if eq .ClaimantId $.CurrentUserId}}
<span style="color: blue;">{{if .Sent}}Completed{{else}}Claimed{{end}} by you</span>
{{else}}
<span style="color: red;">{{if .Sent}}Completed{{else}}Claimed{{end}} by {{.ClaimantName}}</span>
{{end}}
{{end}}
</label>
</li>
{{end}}
</ul>
</form>
{{end}}