{{ 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 }}
