54 lines
1.8 KiB
Go Template
54 lines
1.8 KiB
Go Template
{{define "body"}}
|
|
<h1>Lishwist</h1>
|
|
<nav>
|
|
<ul>
|
|
<li>
|
|
<a href="/">Home</a>
|
|
</li>
|
|
</ul>
|
|
</nav>
|
|
<section>
|
|
<h2>{{.Username}}'s list</h2>
|
|
{{with .Gifts}}
|
|
<form method="post" action="/{{$.UserReference}}/update" autocomplete="off"
|
|
onchange="acceptNames(this, 'claimSubmit', 'claimed', 'unclaimed'); acceptNames(this, 'completeSubmit', 'claimed');">
|
|
<button id="claimSubmit" type="submit" name="mode" value="claim" disabled>Claim/Unclaim</button>
|
|
<button id="completeSubmit" type="submit" name="mode" value="complete" disabled>Complete</button>
|
|
<ul>
|
|
{{range .}}
|
|
<li>
|
|
<label>
|
|
{{if .ClaimantId}}
|
|
{{if eq .ClaimantId $.CurrentUserId}}
|
|
<input type="checkbox" aria-describedby="wish_detail_{{.Id}}" name="claimed" value="{{.Id}}" {{if
|
|
.Sent}}disabled{{end}}>
|
|
{{else}}
|
|
<input type="checkbox" aria-describedby="wish_detail_{{.Id}}" disabled>
|
|
{{end}}
|
|
{{else}}
|
|
<input type="checkbox" aria-describedby="wish_detail_{{.Id}}" name="unclaimed" value="{{.Id}}" {{if
|
|
.Sent}}disabled{{end}}>
|
|
{{end}}
|
|
{{if .Sent}}
|
|
<s>{{.Name}}</s>
|
|
{{else}}
|
|
{{.Name}}
|
|
{{end}}
|
|
</label>
|
|
{{if .ClaimantId}}
|
|
{{if eq .ClaimantId $.CurrentUserId}}
|
|
<span id="wish_detail_{{.Id}}" style="color: blue;">{{if .Sent}}Completed{{else}}Claimed{{end}} by you</span>
|
|
{{else}}
|
|
<span id="wish_detail_{{.Id}}" style="color: red;">{{if .Sent}}Completed{{else}}Claimed{{end}} by
|
|
{{.ClaimantName}}</span>
|
|
{{end}}
|
|
{{end}}
|
|
</li>
|
|
{{end}}
|
|
</ul>
|
|
</form>
|
|
{{else}}
|
|
<p>They haven't wished for anything. Ask them to think of some stuff!</p>
|
|
{{end}}
|
|
</section>
|
|
{{end}} |