feat: add app code

- journal domain package
- httpserver package
- html templates
- main.go in root dir
This commit is contained in:
Vojtěch Mareš 2025-04-22 22:01:53 +02:00
parent 3cc4d28aac
commit 943922a6e1
Signed by: vojtech.mares
GPG key ID: C6827B976F17240D
20 changed files with 1032 additions and 0 deletions

28
templates/entry.html Normal file
View file

@ -0,0 +1,28 @@
{{ template "layout.html" . }}
{{ define "title" }}{{ .Title }} [{{ .FormattedDate }}]{{ end }}
{{ define "content" }}
<script>
function deleteEntry(event) {
event.preventDefault();
if (window.confirm('Do you really want to delete this entry?')) {
document.getElementById('delete-entry').submit();
}
}
</script>
<main class="container">
<h1>{{ .Title }}</h1>
<h2>[{{ .FormattedDate }}]</h2>
<hr />
<p>
[<a href="/entry/{{ .ID }}/edit">Edit</a>]
[<a href="#" onclick="deleteEntry(event)">Delete</a>]
</p>
<form id="delete-entry" action="/entry/delete" method="POST">
<input type="hidden" name="id" value="{{ .ID }}">
</form>
<hr />
<p>{{ .HTMLContent }}</p>
</main>
{{ end }}