44 lines
No EOL
1.2 KiB
HTML
44 lines
No EOL
1.2 KiB
HTML
<!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> |