s1llyw0rdz/web/handler/html.go
2021-11-26 23:36:48 +01:00

212 lines
6.5 KiB
Go

// Code generated by go generate; DO NOT EDIT.
package handler
var TplMap = map[string]string{
"confirm_remove_status": `{{ define "content" }}
Are you sure you you want to delete the following status?
<p>{{ .status.Content }}</p>
<form action="/remove-status" method="post">
<input type="hidden" name="id"/>
<input type="submit" value="Submit">
</form>
{{ end }}`,
"create_status": `<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>status cafe</title>
<meta name="description" content="your friends' updates">
</head>
<body>
<main>
<h1>New status</h1>
{{ if .form.Error }}
<p>{{ .form.Error }}</p>
{{ end }}
{{ if .flash }}
<p>{{ .flash }}</p>
{{ end }}
<form action="/status-save?silent=1" method="post" name="update-status">
<div class="field">
<textarea name="content" placeholder="What's new?" required style="width: 100%; box-sizing: border-box;" autofocus></textarea>
</div>
<br>
<input type="submit" value="Submit">
</form>
</main>
</div>
<script>
document.forms["update-status"].onsubmit = function (event) {
event.preventDefault();
fetch("/status-save?silent=1", {
method: "POST",
body: new FormData(document.forms["update-status"])
})
.then(response => response.ok)
.then(submitted => {
if (submitted) {
window.close()
window.location = "/"
}
})
}
</script>
</body>
</html>`,
"edit_status": `{{ define "content" }}
<h1>Edit status</h1>
{{ if .form.Error }}
<p>{{ .form.Error }}</p>
{{ end }}
{{ if .flash }}
<p>{{ .flash }}</p>
{{ end }}
<form action="/statuses/{{ .status.Id }}/update" method="post">
<div class="field">
<div class="field">
<textarea name="content" placeholder="What's new?" required style="width: 100%; box-sizing: border-box;" autofocus>{{ .status.Content }}</textarea>
</div>
</div>
<input type="submit" value="Submit">
</form>
{{ end }}`,
"index": `{{ define "content" }}
<div class="cols">
<section>
<h2>Set your status</h2>
{{ if .form.Error }}
<p>{{ .form.Error }}</p>
{{ end }}
{{ if .flash }}
<p>{{ .flash }}</p>
{{ end }}
<form action="/status-save" method="post">
<div class="field">
<textarea name="content" maxlength="140" placeholder="What's new?" required style="width: 100%; box-sizing: border-box; height: 100px;" autofocus></textarea>
</div>
<input type="submit" value="Submit">
<h3>Update status with bookmarklet</h3>
<p>Drag to your bookmarks to update from anywhere: <a href="javascript:void(open('https://status.cafe/status-new','status.cafe','resizable,scrollbars,width=360,height=200'))">Set status</a></p>
<h3>Display status on your homepage</h3>
<p>todo</p>
</form>
</section>
<section>
<h2>Status stream</h2>
{{ range .statuses }}
{{ template "status" . }}
{{ end }}
</section>
</div>
{{ end }}`,
"login": `{{ define "content" }}
<h1>Login</h1>
{{ if .form.Error }}
<p>{{ .form.Error }}</p>
{{ end }}
<form action="/check-login" method="post" class="auth-form">
<div class="field">
<label for="name">Username</label>
<input type="text" id="name" name="name" autocomplete="off" required autofocus/>
</div>
<div class="field">
<label for="password">Password</label>
<input type="password" id="password" name="password" required/>
</div>
<br>
<input type="submit" value="Submit">
</form>
{{ end }}`,
"register": `{{ define "content" }}
<h1>Register</h1>
{{ if .form.Error }}
<p>{{ .form.Error }}</p>
{{ end }}
<form action="/register" method="post" class="auth-form">
<div class="field">
<label for="name">Username</label>
<input type="text" id="name" name="name" autocomplete="off" required autofocus/>
</div>
<div class="field">
<label for="password">Password</label>
<input type="password" id="password" name="password" required/>
</div>
<div class="field">
<label for="password-confirm">Confirm password</label>
<input type="password" id="password-confirm" name="password-confirm" required/>
</div>
<br>
<input type="submit" value="Submit">
</form>
{{ end }}`,
"settings": `{{ define "content" }}
<section>
<h1>Settings</h1>
{{ if .flash }}
<p>{{ .flash }}</p>
{{ end }}
<form action="/settings-update" method="post">
<div class="field">
<label for="homepage">homepage</label>
<input type="text" name="homepage" id="homepage" value="{{ .Homepage }}" autocomplete="off"/>
</div>
<div class="field">
<label for="picture">picture URL</label>
<input type="text" name="picture" id="picture" value="{{ .Picture }}" autocomplete="off"/>
</div>
<div class="field">
<label for="about">about</label>
<textarea name="about" id="about" rows="20">{{ .About }}</textarea>
</div>
<div class="field">
<label for="style">style</label>
<textarea name="style" id="style" rows="20">{{ .Style }}</textarea>
</div>
<input type="submit" value="Submit">
</form>
</section>
{{ end }}`,
"user": `{{ define "head" }}
<style>{{ .style }}</style>
{{ end }}
{{ define "content" }}
<div class="cols">
<section>
<img src="{{ .picture }}" width="100" class="profile-picture"/>
<h2>{{ .user }}</h2>
<dl>
<dt>Homepage</dt>
<dd><a href="{{ .homepage }}" target="_blank">{{ .homepage }}</a></dd>
<dt>About</dt>
<dd>{{ .about }}</dd>
</dl>
</section>
<section>
<h2>Statuses</h2>
{{ range .statuses }}
{{ template "status" . }}
{{ end }}
{{ if or .showMore (ne 0 .page) }}
<p>
{{ if ne 0 .page }}
{{ if eq 0 .prev_page }}
<a href="{{ .user }}">Newer statuses</a>
{{ else }}
<a href="{{ .user }}?page={{ .prev_page }}">Newer statuses</a>
{{ end }}
{{ end }}
{{ if .showMore }}
<a href="{{ .user }}?page={{ .next_page }}">Older statuses</a>
{{- end }}
</p>
{{ end }}
</section>
</div>
{{ end }}`,
}