Rework templates to be less hard-coded

This commit is contained in:
Andrew-71 2024-03-30 13:51:29 +03:00
parent a66e26477c
commit 02e1c80c24
7 changed files with 28 additions and 32 deletions

View file

@ -14,7 +14,7 @@
<link rel="icon" type="image/x-icon" href="/public/favicon.ico">
<link rel="stylesheet" href="/public/main.css">
<script src="/public/date.js"></script>
<title>Hibiscus.txt</title>
<title>Hibiscus</title>
</head>
<body>
{{template "header" .}}

View file

@ -1,4 +0,0 @@
{{define "main"}}
<h2><label for="day">{{ .Date }}</label> | <a href="/day">Go back</a></h2>
<textarea id="day" cols="40" rows="15" readonly>{{ .Day }}</textarea>
{{end}}

7
pages/edit.html Normal file
View file

@ -0,0 +1,7 @@
{{define "main"}}
<form method="POST">
<h2><label for="text">{{ .Title }}:</label></h2>
<textarea id="text" cols="40" rows="15" name="text">{{ .Content }}</textarea>
<button type="submit">Save</button>
</form>
{{end}}

4
pages/entry.html Normal file
View file

@ -0,0 +1,4 @@
{{define "main"}}
<h2><label for="text">{{ .Title }}</label> | <a href="/day">Go back</a></h2>
<textarea id="text" cols="40" rows="15" readonly>{{ .Content }}</textarea>
{{end}}

View file

@ -1,7 +0,0 @@
{{define "main"}}
<form method="POST">
<h2><label for="day">Your day so far:</label></h2>
<textarea id="day" cols="40" rows="15" name="day">{{ .Day }}</textarea>
<button type="submit">Save</button>
</form>
{{end}}

View file

@ -2,7 +2,7 @@
<h2>{{.Title}}</h2>
<ul>
{{range .Entries}}
<li><a href="/day/{{.Link}}">{{.Name}}</a></li>
<li><a href="/{{.Link}}">{{.Title}}</a></li>
{{end}}
</ul>
{{end}}