s1llyw0rdz/web/handler/html.go
2021-11-28 08:40:11 +01:00

260 lines
7.9 KiB
Go

// Code generated by go generate; DO NOT EDIT.
package handler
var TplMap = map[string]string{
"confirm_remove_status": `{{ define "content" }}
<section>
Are you sure you you want to delete the following status?
<p>{{ .status.Content }}</p>
<form action="/remove?id={{ .status.Id }}" method="post">
<input type="hidden" name="id"/>
<input type="submit" value="Submit">
</form>
</section>
{{ 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">
<style>
body {
background-color: lightblue;
font-family: Verdana;
}
</style>
</head>
<body>
<main>
{{ if .form.Error }}
<p>{{ .form.Error }}</p>
{{ end }}
{{ if .flash }}
<p>{{ .flash }}</p>
{{ end }}
<form action="/add?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; height: 120px" autofocus></textarea>
</div>
<br>
<input type="submit" value="Submit">
</form>
</main>
</div>
<script>
document.forms["update-status"].onsubmit = function (event) {
event.preventDefault();
fetch("/add?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" }}
<section>
<h1>Edit status</h1>
{{ if .form.Error }}
<p>{{ .form.Error }}</p>
{{ end }}
{{ template "flash" .flash }}
<form action="/edit?id={{ .status.Id }}" 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>
</section>
{{ end }}`,
"index": `{{ define "content" }}
<div class="cols">
<section>
<h2>Set your status</h2>
{{ if .form.Error }}
<p>{{ .form.Error }}</p>
{{ end }}
{{ template "flash" .flash }}
<form action="/add" 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/add','status.cafe','resizable,scrollbars,width=360,height=200'))">status.cafe</a></p>
<h3>Display status on your homepage</h3>
<p>todo</p>
</form>
</section>
<section>
<h2>Status stream</h2>
{{ range .statuses }}
<article class="status">
{{ template "status" . }}
</article>
{{ end }}
</section>
</div>
{{ end }}`,
"login": `{{ define "content" }}
<section>
<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>
</section>
{{ end }}`,
"manage": `{{ define "content" }}
<section>
<h2>Manage statuses</h2>
{{ template "flash" .flash }}
{{ range .statuses }}
<article class="status">
{{ template "status" . }}
{{ if eq $.logged .User }}
<nav><a href="/edit?id={{ .Id }}">Edit</a> <a href="/remove?id={{ .Id }}">Delete</a></nav>
{{ end }}
</article>
{{ end }}
{{ if or .showMore (ne 0 .page) }}
<p>
{{ if ne 0 .page }}
{{ if eq 0 .prev_page }}
<a href="manage">Newer statuses</a>
{{ else }}
<a href="manage?page={{ .prev_page }}">Newer statuses</a>
{{ end }}
{{ end }}
{{ if .showMore }}
<a href="manage?page={{ .next_page }}">Older statuses</a>
{{- end }}
</p>
{{ end }}
</section>
{{ end }}`,
"register": `{{ define "content" }}
<section>
<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>
</section>
{{ end }}`,
"remove_success": `{{ define "content" }}
<section>
{{ template "flash" .flash }}
<a href="/">Back home</a>
</section>
{{ end }}`,
"settings": `{{ define "content" }}
<section>
<h1>Settings</h1>
{{ if .flash }}
<p>{{ .flash }}</p>
{{ end }}
<p><a href="/manage">Manage statuses</a></p>
<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 }}
<article class="status">
{{ template "status" . }}
</article>
{{ 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 }}`,
}