summaryrefslogtreecommitdiff
path: root/srv/src/http/tpl/edit-post.html
blob: 5db06003b7bc692469d832de6060139ace9e13a8 (plain)
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
{{ define "body" }}

<form method="POST" action="{{ BlogURL "posts/" }}">

  <table>

    <tr>
      <td>
        Unique ID
      </td>
      <td>
        {{ if eq .Payload.Post.ID "" }}
        <input
            name="id"
            type="text"
            placeholder="e.g. how-to-fly-a-kite"
            value="{{ .Payload.Post.ID }}" />
        {{ else }}
        <a href="{{ PostURL .Payload.Post.ID }}">{{ .Payload.Post.ID }}</a>
        <input name="id" type="hidden" value="{{ .Payload.Post.ID }}" />
        {{ end }}
      </td>
    </tr>

    <tr>
      <td>Tags (space separated)</td>
      <td>
        <input
            name="tags"
            type="text"
            value="{{- range $i, $tag := .Payload.Post.Tags -}}
                     {{- if ne $i 0 }} {{ end }}{{ $tag -}}
                   {{- end -}}
                  "/>

        {{ if gt (len .Payload.Tags) 0 }}
        <em>
          Existing tags:
          {{ range $i, $tag := .Payload.Tags }}
            {{ if ne $i 0 }} {{ end }}{{ $tag }}
          {{ end }}
        </em>
        {{ end }}
      </td>
    </tr>

    <tr>
      <td>Series</td>
      <td>
        <input
            name="series"
            type="text"
            value="{{ .Payload.Post.Series }}" />
      </td>
    </tr>

    <tr>
      <td>Title</td>
      <td>
        <input
            name="title"
            type="text"
            value="{{ .Payload.Post.Title }}" />
      </td>
    </tr>

    <tr>
      <td>Description</td>
      <td>
        <input
            name="description"
            type="text"
            value="{{ .Payload.Post.Description }}" />
      </td>
    </tr>

  </table>

  <p>
    <textarea
      name="body"
      placeholder="Blog body"
      style="width:100%;height: 75vh;"
      >
      {{- .Payload.Post.Body -}}
    </textarea>
  </p>

  <p>
    <input
      type="submit"
      value="Preview"
      formaction="{{ BlogURL "posts/" }}{{ .Payload.Post.ID }}?method=preview"
      formtarget="_blank"
      />

    {{ if eq .Payload.Post.ID "" }}
    <input type="submit" value="Publish" formaction="{{ BlogURL "posts/" }}" />
    {{ else }}
    <input type="submit" value="Update" formaction="{{ BlogURL "posts/" }}" />
    {{ end }}

  </p>

</form>

<p>
  <a href="{{ BlogURL "posts/" }}">
    Back to Posts
  </a>
</p>
{{ end }}

{{ template "base.html" . }}