Files
chronological/web/templates/partials/diary_form.html
2025-12-10 11:10:52 +01:00

27 lines
832 B
HTML

{{define "diary_form.html"}}
<div class="diary-form">
<h3>Journal Entry - {{.Date.Format "January 2, 2006"}}</h3>
<form
hx-post="/diary/{{formatDate .Date}}"
hx-target="this"
hx-swap="outerHTML">
<textarea
name="text"
rows="8"
placeholder="Write your thoughts...">{{if .Entry}}{{.Entry.Text}}{{end}}</textarea>
<div class="form-actions">
<button type="submit" class="btn btn-primary">Save</button>
{{if .Entry}}
<button
type="button"
class="btn btn-danger"
hx-delete="/diary/{{formatDate .Date}}"
hx-confirm="Delete this diary entry?">
Delete
</button>
{{end}}
</div>
</form>
</div>
{{end}}