summaryrefslogtreecommitdiffstats
path: root/templates
diff options
context:
space:
mode:
Diffstat (limited to 'templates')
-rw-r--r--templates/index.html.template2
-rw-r--r--templates/note.html.template32
-rw-r--r--templates/outline.html.template7
3 files changed, 36 insertions, 5 deletions
diff --git a/templates/index.html.template b/templates/index.html.template
index ee405e4..3dcf4a7 100644
--- a/templates/index.html.template
+++ b/templates/index.html.template
@@ -1,4 +1,4 @@
-{{define "title"}}roseh.moe{{end}}
+{{define "head"}}<title>roseh.moe</title>{{end}}
<div style="background-image:url(/static/index/stars.webp);background-repeat:repeat;height:500px;display:flex">
<h1 style="margin:auto">roseh.moe</h1>
diff --git a/templates/note.html.template b/templates/note.html.template
new file mode 100644
index 0000000..eac0e02
--- /dev/null
+++ b/templates/note.html.template
@@ -0,0 +1,32 @@
+{{define "head"}}
+<script src="/static/htmx.min.js"></script>
+<title>Notepad</title>
+
+<meta name="viewport" content="interactive-widget=resizes-content"> <!-- https://stackoverflow.com/q/76026292 -->
+{{end}}
+
+<form method="post">
+ <div class="save-indicator-container">
+ {{block "saveIndicator" ""}}
+ <span id="save-indicator">{{.}}</span>
+ {{end}}
+ <noscript><input type="submit" value="Save"></noscript>
+ </div>
+ <div class="content-container">
+ <textarea
+ name="content"
+ hx-post="/notepad/autosave"
+ hx-on:input="
+ const indicator = htmx.find('#save-indicator');
+ htmx.addClass(indicator, 'htmx-indicator');
+ indicator.innerHTML = 'Saving...';
+ "
+ hx-trigger="input delay:1s"
+ hx-indicator="#save-indicator"
+ hx-target="#save-indicator"
+ hx-swap="outerHTML"
+ autofocus>
+ {{- .Content -}}
+ </textarea>
+ </div>
+</form>
diff --git a/templates/outline.html.template b/templates/outline.html.template
index 1dbc621..9bea270 100644
--- a/templates/outline.html.template
+++ b/templates/outline.html.template
@@ -1,11 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
- <title>{{template "title" .}}</title>
<link rel="icon" href="/static/icon.webp">
<link rel="stylesheet" href="/static/styles.css">
+
+ {{template "head" .}}
</head>
- <body>
-{{template "body" .}}
- </body>
+ <body>{{template "body" .}}</body>
</html>