s1llyw0rdz/web/handler/html.go
2021-12-22 10:21:14 +01:00

430 lines
14 KiB
Go

// Code generated by go generate; DO NOT EDIT.
package handler
var TplMap = map[string]string{
"admin": `{{ define "content" }}
<section>
<h1>Admin</h1>
{{ range .inactive }}
<div>
<div><b>{{ .Name }}</b> ({{ .SignupEmail }}) <a href="/activate-user?name={{ .Name }}">Activate</a> | <a href="/delete-user?name={{ .Name }}">Delete</a></div>
<p>{{ .SignupMsg }}</p>
</div>
{{ end }}
</section>
{{ end }}`,
"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>
<link rel="stylesheet" href="/assets/style.css"/>
<meta name="description" content="your friends' updates">
<style>
body {
background-color: azure;
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">
{{ template "status_form" .status }}
</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>`,
"current_status": `{{ define "content" }}
<style>
#statuscafe {
padding: .5em;
background-color: azure;
border: 1px solid midnightblue;
}
#statuscafe-username {
margin-bottom: .5em;
}
#statuscafe-content {
margin: 0 1em 0.5em 1em;
}
@media (min-width: 650px) {
.cols {
grid-template-columns: 1fr 1fr;
grid-gap: 2em;
}
}
</style>
<div class="cols">
<div>
<h1>Status widget</h1>
<form method="get" action="/current-status">
<table>
<tr>
<td>name:</td>
<td><input type="text" name="name" id="name" value="{{ .name }}"/></td>
</tr>
<tr>
<td></td>
<td><input type="submit" value="create HTML"/></td>
</tr>
</table>
</form>
<p>Past this code into your HTML file:</p>
<textarea style="width: 100%; max-width: 500px; height: 75px;"><script src="https://status.cafe/current-status.js?name={{ .name }}"></script></textarea>
<p>Past this code into your CSS file:</p>
<textarea style="width: 100%; max-width: 500px; height: 175px;">#statuscafe {
padding: .5em;
background-color: azure;
border: 1px solid midnightblue;
}
#statuscafe-username {
margin-bottom: .5em;
}
#statuscafe-content {
margin: 0 1em 0.5em 1em;
}</textarea>
<p>Make it your own! The CSS above is only an example. Tweak it so that it integrates well with your sites's colors.</p>
</div>
<div>
<h2>Preview</h2>
{{ if .name }}
<script src="https://status.cafe/current-status.js?name={{ .name }}"></script>
{{ else }}
<p>Add your name and click "generate HTML" to see a preview.</p>
{{ end }}
</div>
</div>
{{ end }}
`,
"edit_status": `{{ define "content" }}
<h1>Edit status</h1>
{{ if .form.Error }}
<p>{{ .form.Error }}</p>
{{ end }}
{{ template "flash" .flash }}
<form action="/edit?id={{ .status.Id }}" method="post">
{{ template "status_form" .status }}
</form>
{{ end }}`,
"index": `{{ define "content" }}
<div class="cols">
<section>
{{ if .logged }}
<h2>Set your status</h2>
{{ if .form.Error }}
<p>{{ .form.Error }}</p>
{{ end }}
<form action="/add" method="post">{{ template "status_form" .status }}</form>
<ul class="tools">
<li><a href="/about/status-updater">status updater</a> bookmarklet</li>
<li><a href="/current-status">status widget</a> for your homepage</li>
</ul>
<p><a href="/feed.atom">Subscribe via Atom</a></p>
{{ else }}
<h2>Welcome!</h2>
<p>status.cafe is a place to share your current status.</p>
<p><a href="/register">Register now!</a></p>
{{ end }}
<p><img src="/assets/button.png"/></p>
</section>
<section>
<h2>Status stream</h2>
{{ range .statuses }}
<article class="status">
{{ template "status" . }}
</article>
{{ end }}
</section>
</div>
{{ end }}
`,
"intro": `{{ define "content" }}
<section>
<h1>Introduction</h1>
<p>
Welcome! You've just found a little internet tool that lets you set your current status
and see the status of others.
</p>
<h2>Your status</h2>
<p>
Once you've registered, you will be able to set your current status. A status is anything you are currently doing,
on your mind, or that you think about. It can be your mood, the song you are listening to, the book you are reading, or the new
cool link you've just found. A status has a maximum length of 140 characters and can be updated as often as you'd like.
</p>
<h2>Status updater</h2>
<p>
Use the status updater bookmarklet to update your status from anywhere, and capture all your feelings on your
profile page.
</p>
<h2>Homepage widgets</h2>
<h3>Current Status Widget</h3>
<h3>Status Feed Widget</h3>
<!-- wip -->
<p>Use the current status widget to display your latest status directly on
homepage, or the status feed widget to display the last few ones.
</p>
<p>
Use the status updater bookmarklet to update your status from anywhere, and capture all your feelings on your
profile page, which aggregates all your statuses. You can fully customize it with CSS and HTML. Make it yours!
</p>
</section>
{{ 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" }}
<h1>Manage statuses</h1>
{{ 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 }}
{{ 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 maxlength="20" autofocus/>
</div>
<div class="field">
<label for="email">Email</label>
<input type="email" id="email" name="email" autocomplete="off" required/>
</div>
<div class="field">
<label for="show-email">Show e-mail</label>
<input type="checkbox" name="show-email" value="1" id="show-email" style="width: inherit;">
</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>
<div class="field">
<label for="answer">How did you discover status.cafe?</label>
<textarea id="answer" name="answer" required></textarea>
</div>
<input type="submit" value="Submit">
</form>
</section>
{{ end }}`,
"register-success": `{{ define "content" }}
<section>
<h1>Thank you!</h1>
<p>Thanks for registering, {{ .name }}!</p>
<p>You should receive a confirmation email on {{ .email }} as soon as your account is activated.</p>
</section>
{{ end }}`,
"settings": `{{ define "content" }}
<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="{{ .User.Homepage }}" autocomplete="off"/>
</div>
<div class="field">
<label for="email">Email</label>
<input type="text" name="email" id="email" value="{{ .User.Email }}" autocomplete="off"/>
</div>
<div class="field">
<label for="picture">Picture URL</label>
<input type="text" name="picture" id="picture" value="{{ .User.Picture }}" autocomplete="off"/>
</div>
<div class="field">
<label for="about">About (accepts HTML, including a style tag)</label>
<textarea name="about" id="about" rows="20">{{ .User.About }}</textarea>
</div>
<input type="submit" value="Submit">
</form>
{{ end }}`,
"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>
<link rel="stylesheet" href="/assets/style.css"/>
<meta name="description" content="your friends' updates">
</head>
<body>
{{ if .status.Content }}
{{ template "status" .status }}
{{ end }}
</body>
</html>`,
"status-updater": `{{ define "content" }}
<section>
<h1>Status Updater</h1>
<p>
Instead of having to come back each time you want to set a new status, you can install the
status updater bookmarklet directly to your web browser. That way, you will be able to update your status
from anywhere.
</p>
<p>
Curious about what a bookmarklet is? It's simply a little javascript link that's placed on your browser's bookmark toolbar.
You can think about them as tiny programs.
</p>
<h2>Instructions</h2>
<p>
Drag the following link to your bookmarks toolbar:
</p>
<p>
<a href="javascript:void(open('https://status.cafe/add','status.cafe','resizable,scrollbars,width=350,height=350'))">status updater</a>
</p>
<p>That's it! From now on, whenever you want to update your status, click the status updater button from your bookmarks and a pop-up window will launch to let you update it.</p>
</section>
{{ end }}`,
"user": `{{ define "head" }}
<link rel="alternate" type="application/atom+xml" title="Atom feed" href="/users/{{ .user }}.atom" />
{{ end }}
{{ define "title" }}{{ .user }} - {{ end }}
{{ define "content" }}
<div class="cols">
<section>
<h2>{{ .user }}</h2>
{{ if .picture }}
<img src="{{ .picture }}" width="100" class="profile-picture"/>
{{ end }}
<p><a href="/users/{{ .user }}.atom">Subscribe via Atom</a></p>
<dl>
<dt>Homepage</dt>
<dd>
{{ if .homepage }}
<a href="{{ .homepage }}" target="_blank">{{ .homepage }}</a></dd>
{{ else }}
Not defined
{{ end }}
<dt>Email</dt>
<dd>
{{ if .email }}
<a href="{{ .email }}" target="_blank">{{ .email }}</a></dd>
{{ else }}
Not defined
{{ end }}
<dt>About</dt>
<dd>
{{ if .about }}
{{ .about }}
{{ else }}
Not defined
{{ end }}
</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 }}`,
}