summaryrefslogtreecommitdiffstats
path: root/templates/admin/list.html
blob: 561e3173e7449fcedc3389d1264de50a554febca (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
{{define "list-content"}}
  <h1>Posts</h1>
  {{if .Posts}}
  <table>
    <thead>
      <tr>
        <th>Title</th>
        <th>Date</th>
        <th>Tags</th>
        <th></th>
      </tr>
    </thead>
    <tbody>
      {{range .Posts}}
      <tr>
        <td>{{.Title}}</td>
        <td>{{.Date}}</td>
        <td>
          {{if .Tags}}
          <div class="tags">
            {{range (splitTags .Tags)}}<span class="tag">{{.}}</span>{{end}}
          </div>
          {{end}}
        </td>
        <td>
          <div class="actions">
            <a href="/admin/{{.Slug}}/edit" class="btn btn-secondary">Edit</a>
            <form method="POST" action="/admin/{{.Slug}}/delete" onsubmit="return confirm('Delete {{.Title}}?')">
              <button type="submit" class="btn btn-danger">Delete</button>
            </form>
          </div>
        </td>
      </tr>
      {{end}}
    </tbody>
  </table>
  {{else}}
  <div class="empty">No posts yet. <a href="/admin/new">Create one.</a></div>
  {{end}}
{{end}}