feat: add app code
- journal domain package - httpserver package - html templates - main.go in root dir
This commit is contained in:
parent
3cc4d28aac
commit
943922a6e1
20 changed files with 1032 additions and 0 deletions
28
templates/entry.html
Normal file
28
templates/entry.html
Normal 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 }}
|
||||
Loading…
Add table
Add a link
Reference in a new issue