<!DOCTYPE html>
<html>
  <head>
    <title>Administration</title>
    <link rel="stylesheet" href="/css/admin.css">
    <link rel="preconnect" href="https://fonts.gstatic.com">
		<link href='https://fonts.googleapis.com/css?family=Average|Montserrat' rel='stylesheet' type='text/css'>
  </head>
  <body>
    <header>
      <h3><a href="/admin">Admin</a></h3>
      <div class="right-header">
        <a href="/admin/logout">Logout</a>
      </div>
    </header>
    <main>
      <h2>Admin</h2>
        <div class="list-header">
        <h3>Posts</h3>
          <a id="new-post" href="/admin/post/new"><button>New</button></a>
        </div>
        <div id="post-list">
          <!-- Table starts here -->
          <table class="post-table">
            <thead>
              <tr>
                <th>Title</th>
                <th>Created At</th>
                <th>Updated At</th>
                <th></th>
              </tr>
            </thead>
            <tbody>
              {{ range $post := .Posts }}
              <tr>
                <td data-title="Username">{{ $post.Title }}</td>
                <td data-title="Created At">{{ FormatTimestamp $post.CreatedAt }}</td>
                <td data-title="Updated At">{{ FormatTimestamp $post.UpdatedAt }}</td>
                <td data-title=""><a href="/admin/post/{{ $post.ID }}/edit"><button>Edit</button></a></td>
              </tr>
              {{ end }}
            </tbody>
          </table>
        </div>
    </main>
  </body>
</html>

