s1llyw0rdz/web/handler/html.go

376 lines
12 KiB
Go
Raw Normal View History

2021-11-22 09:06:23 +00:00
// Code generated by go generate; DO NOT EDIT.
package handler
var TplMap = map[string]string{
2021-11-22 13:30:20 +00:00
"confirm_remove_status": `{{ define "content" }}
2021-11-28 07:40:11 +00:00
<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>
2021-11-22 13:30:20 +00:00
{{ end }}`,
2021-11-24 06:30:19 +00:00
"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">
2021-11-28 07:40:11 +00:00
<style>
body {
background-color: lightblue;
font-family: Verdana;
}
</style>
2021-11-24 06:30:19 +00:00
</head>
<body>
<main>
{{ if .form.Error }}
<p>{{ .form.Error }}</p>
{{ end }}
{{ if .flash }}
<p>{{ .flash }}</p>
{{ end }}
2021-11-28 07:40:11 +00:00
<form action="/add?silent=1" method="post" name="update-status">
2021-11-24 06:30:19 +00:00
<div class="field">
2021-11-28 07:40:11 +00:00
<textarea name="content" placeholder="What's new?" required style="width: 100%; box-sizing: border-box; height: 120px" autofocus></textarea>
2021-11-24 06:30:19 +00:00
</div>
<br>
<input type="submit" value="Submit">
</form>
</main>
</div>
<script>
document.forms["update-status"].onsubmit = function (event) {
event.preventDefault();
2021-11-28 07:40:11 +00:00
fetch("/add?silent=1", {
2021-11-24 06:30:19 +00:00
method: "POST",
body: new FormData(document.forms["update-status"])
})
.then(response => response.ok)
.then(submitted => {
if (submitted) {
window.close()
window.location = "/"
}
})
}
</script>
</body>
</html>`,
2021-11-28 21:38:08 +00:00
"current_status": `{{ define "content" }}
<div class="cols">
<section>
<h1>Current 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 id="code-html" style="width: 100%; height: 75px;"></textarea>
</section>
<section>
<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 }}
</section>
</div>
<script>
function getHTML(name) {
return '<s'+'cript src="https://status.cafe/current-status.js?name=' + name + '"></s'+'cript>'
}
function preview() {
const name = document.getElementById("name").value
if (name) {
const code = getHTML(document.getElementById("name").value)
document.getElementById("code-html").value = code
}
}
preview()
</script>
{{ end }}`,
2021-11-22 13:23:30 +00:00
"edit_status": `{{ define "content" }}
2021-11-28 07:40:11 +00:00
<section>
<h1>Edit status</h1>
{{ if .form.Error }}
<p>{{ .form.Error }}</p>
{{ end }}
{{ template "flash" .flash }}
<form action="/edit?id={{ .status.Id }}" method="post">
2021-11-22 20:23:30 +00:00
<div class="field">
2021-11-28 07:40:11 +00:00
<div class="field">
<textarea name="content" placeholder="What's new?" required style="width: 100%; box-sizing: border-box;" autofocus>{{ .status.Content }}</textarea>
</div>
2021-11-22 20:23:30 +00:00
</div>
2021-11-28 07:40:11 +00:00
<input type="submit" value="Submit">
</form>
</section>
2021-11-22 13:00:19 +00:00
{{ end }}`,
2021-11-22 09:06:23 +00:00
"index": `{{ define "content" }}
2021-11-22 20:23:30 +00:00
<div class="cols">
<section>
<h2>Set your status</h2>
{{ if .form.Error }}
<p>{{ .form.Error }}</p>
{{ end }}
2021-11-28 07:40:11 +00:00
{{ template "flash" .flash }}
<form action="/add" method="post">
2021-11-22 20:23:30 +00:00
<div class="field">
2021-11-26 22:36:48 +00:00
<textarea name="content" maxlength="140" placeholder="What's new?" required style="width: 100%; box-sizing: border-box; height: 100px;" autofocus></textarea>
2021-11-22 20:23:30 +00:00
</div>
<input type="submit" value="Submit">
2021-11-28 21:38:08 +00:00
<ul class="tools">
<li>Install the <a href="/about/status-updater">status updater</a> bookmarklet</li>
<li>Add the <a href="/current-status">current status widget</a> to your homepage</li>
</ul>
2021-11-22 20:23:30 +00:00
</form>
</section>
<section>
<h2>Status stream</h2>
{{ range .statuses }}
2021-11-27 09:39:34 +00:00
<article class="status">
{{ template "status" . }}
</article>
2021-11-22 20:23:30 +00:00
{{ end }}
</section>
</div>
2021-11-28 21:38:08 +00:00
{{ 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>
2021-11-22 09:26:30 +00:00
{{ end }}`,
"login": `{{ define "content" }}
2021-11-28 07:40:11 +00:00
<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>
2021-11-22 09:26:30 +00:00
{{ end }}`,
"register": `{{ define "content" }}
2021-11-28 07:40:11 +00:00
<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>
2021-11-24 06:30:19 +00:00
{{ end }}`,
2021-11-25 06:37:30 +00:00
"settings": `{{ define "content" }}
2021-11-24 06:30:19 +00:00
<section>
2021-11-25 06:37:30 +00:00
<h1>Settings</h1>
{{ if .flash }}
<p>{{ .flash }}</p>
2021-11-24 06:30:19 +00:00
{{ end }}
2021-11-28 07:40:11 +00:00
<p><a href="/manage">Manage statuses</a></p>
2021-11-25 06:37:30 +00:00
<form action="/settings-update" method="post">
<div class="field">
<label for="homepage">homepage</label>
2021-11-28 14:31:51 +00:00
<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"/>
2021-11-25 06:37:30 +00:00
</div>
2021-11-26 22:36:48 +00:00
<div class="field">
<label for="picture">picture URL</label>
2021-11-28 14:31:51 +00:00
<input type="text" name="picture" id="picture" value="{{ .User.Picture }}" autocomplete="off"/>
2021-11-26 22:36:48 +00:00
</div>
2021-11-25 06:37:30 +00:00
<div class="field">
<label for="about">about</label>
2021-11-28 14:31:51 +00:00
<textarea name="about" id="about" rows="20">{{ .User.About }}</textarea>
2021-11-25 06:37:30 +00:00
</div>
2021-11-26 22:36:48 +00:00
<div class="field">
<label for="style">style</label>
2021-11-28 14:31:51 +00:00
<textarea name="style" id="style" rows="20">{{ .User.Style }}</textarea>
2021-11-26 22:36:48 +00:00
</div>
2021-11-25 06:37:30 +00:00
<input type="submit" value="Submit">
</form>
2021-11-24 06:30:19 +00:00
</section>
2021-11-28 21:38:08 +00:00
{{ end }}`,
"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=360,height=200'))">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>
2021-11-25 06:37:30 +00:00
{{ end }}`,
2021-11-26 22:36:48 +00:00
"user": `{{ define "head" }}
<style>{{ .style }}</style>
{{ end }}
{{ define "content" }}
2021-11-25 06:37:30 +00:00
<div class="cols">
<section>
<h2>{{ .user }}</h2>
2021-11-28 21:38:08 +00:00
{{ if .picture }}
2021-11-28 14:31:51 +00:00
<img src="{{ .picture }}" width="100" class="profile-picture"/>
2021-11-28 21:38:08 +00:00
{{ end }}
2021-11-25 06:37:30 +00:00
<dl>
<dt>Homepage</dt>
2021-11-28 21:38:08 +00:00
<dd>
{{ if .homepage }}
<a href="{{ .homepage }}" target="_blank">{{ .homepage }}</a></dd>
{{ else }}
Not defined
{{ end }}
2021-11-28 14:31:51 +00:00
<dt>Email</dt>
2021-11-28 21:38:08 +00:00
<dd>
{{ if .email }}
<a href="{{ .email }}" target="_blank">{{ .email }}</a></dd>
{{ else }}
Not defined
{{ end }}
2021-11-25 06:37:30 +00:00
<dt>About</dt>
2021-11-28 21:38:08 +00:00
<dd>
{{ if .about }}
{{ .about }}
{{ else }}
Not defined
{{ end }}
</dd>
2021-11-25 06:37:30 +00:00
</dl>
</section>
<section>
<h2>Statuses</h2>
{{ range .statuses }}
2021-11-27 09:39:34 +00:00
<article class="status">
{{ template "status" . }}
</article>
2021-11-25 06:37:30 +00:00
{{ end }}
2021-11-26 22:36:48 +00:00
{{ 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 }}
2021-11-25 06:37:30 +00:00
</section>
</div>
2021-11-22 09:06:23 +00:00
{{ end }}`,
}