apps/quotes/templates/admin.html 3.0 K raw
1
<!doctype html>
2
<html lang="en">
3
  <head>
4
    <meta charset="UTF-8" />
5
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
    <meta name="theme-color" content="#121113" />
7
    <link rel="stylesheet" href="/assets/darkmatter.css" />
8
    <link rel="stylesheet" href="/static/styles.css" />
9
    <link rel="apple-touch-icon" sizes="180x180" href="/static/apple-touch-icon.png" />
10
    <link rel="icon" type="image/png" sizes="32x32" href="/static/favicon-32x32.png" />
11
    <link rel="icon" type="image/png" sizes="16x16" href="/static/favicon-16x16.png" />
12
    <link rel="icon" href="/static/favicon.ico" />
13
    <link rel="manifest" href="/static/site.webmanifest" />
14
    <title>Quotes | Admin</title>
15
  </head>
16
  <body>
17
    <div class="header">
18
      <a href="/" class="logo">QUOTES</a>
19
      <nav class="links">
20
        <a href="/admin/logout">logout</a>
21
      </nav>
22
    </div>
23
24
    {{if .Success}}<p class="success">{{.Success}}</p>{{end}}
25
    {{if .Error}}<p class="error">{{.Error}}</p>{{end}}
26
27
    <form class="form" method="POST" action="/admin/add">
28
      <div class="form-field">
29
        <label for="text">Quote</label>
30
        <textarea id="text" name="text" rows="3" placeholder="the quote" required></textarea>
31
      </div>
32
      <div class="form-row">
33
        <div class="form-field">
34
          <label for="author">Author</label>
35
          <input type="text" id="author" name="author" placeholder="author" required />
36
        </div>
37
        <div class="form-field">
38
          <label for="source">Source</label>
39
          <input type="text" id="source" name="source" placeholder="book / work (optional)" />
40
        </div>
41
      </div>
42
      <div class="form-actions">
43
        <button type="submit">Add quote</button>
44
      </div>
45
    </form>
46
47
    <div class="admin-toolbar">
48
      <h2>Quotes ({{.Total}})</h2>
49
      <form method="GET" action="/admin" class="form-row">
50
        <div class="form-field">
51
          <input type="text" name="q" placeholder="search text, author, source" value="{{.Query}}" />
52
        </div>
53
        <button type="submit">Search</button>
54
        {{if .Searched}}<a href="/admin" class="link-button">clear</a>{{end}}
55
      </form>
56
    </div>
57
58
    {{if not .Quotes}}
59
    <p class="empty">
60
      {{if .Searched}}No matches.{{else}}No quotes yet. Add one above or seed from the CSV.{{end}}
61
    </p>
62
    {{else}}
63
    <ul class="admin-list">
64
      {{range .Quotes}}
65
      <li class="admin-list-item">
66
        <div class="admin-list-info">
67
          <span class="admin-list-title">{{.Text}}</span>
68
          <span class="admin-list-meta">&mdash; {{.Author}}{{if .Source}}, <cite>{{.Source}}</cite>{{end}}</span>
69
        </div>
70
        <div class="admin-list-actions">
71
          <form method="POST" action="/admin/quotes/{{.ShortID}}/delete" class="inline-form">
72
            <button type="submit" class="link-button danger">delete</button>
73
          </form>
74
        </div>
75
      </li>
76
      {{end}}
77
    </ul>
78
    {{if not .Searched}}
79
    <p class="empty">Showing the 50 most recent. Use search to find older quotes.</p>
80
    {{end}}
81
    {{end}}
82
  </body>
83
</html>