feat: empty list prompts

This commit is contained in:
Teajey 2024-05-13 20:57:25 +12:00
parent e90ca47c5d
commit 04647f3bcd
Signed by: Teajey
GPG Key ID: 970E790FE834A713
2 changed files with 94 additions and 77 deletions

View File

@ -7,13 +7,15 @@
</li>
</ul>
</nav>
<section>
<h2>{{.Username}}'s list</h2>
<form method="post" action="/{{.UserReference}}/update" autocomplete="off"
{{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 .Gifts}}
{{range .}}
<li>
<label>
{{if .ClaimantId}}
@ -42,4 +44,8 @@
{{end}}
</ul>
</form>
{{else}}
<p>They haven't wished for anything. Ask them to think of some stuff!</p>
{{end}}
</section>
{{end}}

View File

@ -10,11 +10,13 @@
<pre>{{.Reference}}</pre>
</dd>
</dl>
<section>
<h2>Your wishlist</h2>
{{with .Gifts}}
<form method="post" action="/wishlist/delete" onchange="acceptNames(this, 'deleteSubmit', 'gift')" autocomplete="off">
<button id="deleteSubmit" type="submit" name="mode" value="delete" disabled>Delete</button>
<ul>
{{range .Gifts}}
{{range .}}
<li>
<label>
<input type="checkbox" name="gift" value="{{.Id}}">
@ -24,17 +26,24 @@
{{end}}
</ul>
</form>
{{else}}
<p>Your list is empty. Think of some things to add!</p>
{{end}}
<form method="post" action="/wishlist/add">
<input name="gift_name" required>
<button type="submit">Add gift idea</button>
</form>
</section>
{{with .Todo}}
<section>
<h2>Your todo list</h2>
<form method="post" action="/todo/update"
onchange="acceptNames(this, 'unclaimSubmit', 'gift'); acceptNames(this, 'completeSubmit', 'gift')" autocomplete="off">
onchange="acceptNames(this, 'unclaimSubmit', 'gift'); acceptNames(this, 'completeSubmit', 'gift')"
autocomplete="off">
<button id="unclaimSubmit" type="submit" name="mode" value="unclaim" disabled>Unclaim</button>
<button id="completeSubmit" type="submit" name="mode" value="complete" disabled>Complete</button>
<ul>
{{range .Todo}}
{{range .}}
<li>
<label>
{{if .Sent}}
@ -54,4 +63,6 @@
{{end}}
</ul>
</form>
</section>
{{end}}
{{end}}