123 lines
4.5 KiB
Go Template
123 lines
4.5 KiB
Go Template
<!doctype html>
|
|
<html>
|
|
|
|
<head>
|
|
{{template "head"}}
|
|
</head>
|
|
|
|
<body>
|
|
<div style="height: 100svh;" class="d-flex flex-column">
|
|
{{template "navbar" .Navbar}}
|
|
<div class="overflow-y-scroll flex-grow-1">
|
|
<div class="container py-5">
|
|
{{- with .Wishlist}}
|
|
<section class="card mb-4">
|
|
<div class="card-body">
|
|
<h2>{{.Label}}</h2>
|
|
{{with .Wishes}}
|
|
{{with .Elements}}
|
|
<form method="post" onchange="acceptNames(this, 'deleteSubmit', 'wish')" autocomplete="off">
|
|
<ul class="list-group mb-3">
|
|
{{range .Items}}
|
|
<li class="list-group-item">
|
|
<input id="wishlist_select_{{.Input.Value}}" class="form-check-input" type="{{.Input.Type}}" name="{{.Input.Name}}"
|
|
value="{{.Input.Value}}">
|
|
<label class="form-check-label stretched-link" for="wishlist_select_{{.Input.Value}}">
|
|
{{.Input.Label}}
|
|
</label>
|
|
</li>
|
|
{{end}}
|
|
</ul>
|
|
<button id="deleteSubmit" class="btn btn-danger mb-3" name="intent" value="delete"
|
|
disabled>Delete</button>
|
|
</form>
|
|
{{end}}
|
|
{{else}}
|
|
<p>Your list is empty. Think of some things to add!</p>
|
|
{{end}}
|
|
{{- with .NewWish}}
|
|
<form method="{{.Method}}">
|
|
{{- with .Elements}}
|
|
<div class="input-group">
|
|
<input class="form-control" name="{{.Name}}" {{- if .Required}} required {{- end}} placeholder="Write a gift idea here" autofocus>
|
|
<button class="btn btn-primary" type="submit" name="intent" value="add_idea">{{.Label}}</button>
|
|
</div>
|
|
{{- end}}
|
|
</form>
|
|
{{- end}}
|
|
</div>
|
|
</section>
|
|
{{- end}}
|
|
|
|
{{- with .Todo}}
|
|
<section class="card mb-4">
|
|
<div class="card-body">
|
|
<h2>{{.Label}}</h2>
|
|
{{with .Wishes}}
|
|
<form method="{{.Method}}"
|
|
onchange="acceptNames(this, 'unclaimSubmit', 'todo'); acceptNames(this, 'completeSubmit', 'todo')"
|
|
autocomplete="off">
|
|
{{- with .Elements}}
|
|
<ul class="list-group mb-3">
|
|
{{range .Items}}
|
|
<li class="list-group-item{{if .Input.Disabled}} list-group-item-light{{end}}">
|
|
<input id="todo_select_{{.Input.Value}}" class="form-check-input" type="{{.Input.Type}}" {{if .Input.Disabled}}
|
|
aria-describedby="todo_detail_{{.Input.Value}}" disabled{{else}} name="{{.Input.Name}}" value="{{.Input.Value}}" {{end}}>
|
|
<label for="todo_select_{{.Input.Value}}" class="form-check-label">
|
|
<em>
|
|
{{if .Input.Disabled}}
|
|
<s>{{.Input.Label}}</s>
|
|
{{else}}
|
|
{{.Input.Label}}
|
|
{{end}}
|
|
</em>
|
|
</label>
|
|
<span id="todo_detail_{{.Input.Value}}">
|
|
for <a href="{{.Recipient.Href}}">{{.Recipient.Label}}</a>
|
|
</span>
|
|
</li>
|
|
{{end}}
|
|
</ul>
|
|
{{ range .Intent.Options -}}
|
|
{{ if eq .Value "unclaim_todo" }}
|
|
<button id="unclaimSubmit" class="btn btn-warning" name="intent" value="unclaim_todo"
|
|
disabled>Unclaim</button>
|
|
{{ else if eq .Value "complete_todo" -}}
|
|
<button id="completeSubmit" class="btn btn-success" name="intent" value="complete_todo"
|
|
disabled>Complete</button>
|
|
{{ end -}}
|
|
{{ end -}}
|
|
{{- end}}
|
|
</form>
|
|
{{else}}
|
|
<p class="mb-0">When you claim gifts for others, they will appear here.</p>
|
|
{{end}}
|
|
</div>
|
|
</section>
|
|
{{- end}}
|
|
|
|
{{with .GroupsList}}
|
|
<section class="card">
|
|
<div class="card-body">
|
|
<h2>{{.Label}}</h2>
|
|
{{with .Links}}
|
|
<ul class="list-group">
|
|
{{range .}}
|
|
<li class="list-group-item">
|
|
<a href="{{.Href}}">{{.Label}}</a>
|
|
</li>
|
|
{{end}}
|
|
</ul>
|
|
{{else}}
|
|
<p>You don't belong to any groups</p>
|
|
{{end}}
|
|
</div>
|
|
</section>
|
|
{{end}}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
|
|
</html>
|