register/regserver/templates.go

52 lines
1.3 KiB
Go

package main
import "html/template"
var header = template.Must(template.New("header").Parse(`<html>
<head>
<title>{{.Title}}</title>
<link rel="stylesheet" href="https://tilde.cat/style.css">
</head>
<body>
`))
var footer = template.Must(header.New("footer").Parse(`</body>
</html>`))
var statusTemplate = template.Must(footer.New("status").Parse(`
{{ template "header" .Global }}
Status: {{ .Status }}
{{ template "footer" .Global }}`))
var errorTemplate = template.Must(footer.New("error").Parse(`
{{ template "header" . }}
<p>Error, all form fields must be non empty.</p>
<a href="/">take ma back</a>
{{ template "footer" . }}`))
var formTemplate = template.Must(header.New("form").Parse(`{{ template "header" . }}
<h1><a href="http://tilde.cat">~🐱</a> Sign up form</h1>
<form action="/post" method="post">
<table>
<tr>
<th>Username:</th>
<th><input type="text" name="username"><br/></th>
</tr>
<tr>
<th>Email:</th>
<th><input type="email" name="email"><br/></th>
</tr>
<tr>
<th>Why would you want an account here?</th>
<th><textarea name="why" cols=50 rows=10></textarea><br/></th>
</tr>
<tr>
<th>SSH key:</th>
<th><textarea name="sshpublickey" cols=50 rows=10></textarea><br/></th>
</tr>
<tr><th colspan="2"><input type="submit" value="Submit"></th></tr>
</table>
</form>
{{ template "footer" . }}
`))