summaryrefslogtreecommitdiff
path: root/srv/src/http/tpl/edit-post.html
blob: 114369ae93818ada485b87d2c73ff995c4b45160 (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
{{ define "body" }}

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

    {{ .CSRFFormInput }}

    <div class="row">

      <div class="columns six">
        <label for="idInput">Unique ID</label>
        {{ if eq .Payload.Post.ID "" }}
          <input
              id="idInput"
              name="id"
              class="u-full-width"
              type="text"
              placeholder="e.g. how-to-fly-a-kite"
              value="{{ .Payload.Post.ID }}" />
        {{ else }}
          <a href="{{ PostURL .Payload.Post.ID }}" target="_blank">{{ .Payload.Post.ID }}</a>
          <input name="id" type="hidden" value="{{ .Payload.Post.ID }}" />
        {{ end }}
      </div>

      <div class="columns three">
        <label for="tagsInput">Tags (space separated)</label>
        <input
            id="tagsInput"
            name="tags"
            class="u-full-width"
            type="text"
            value="{{ range $i, $tag := .Payload.Post.Tags }}{{ if ne $i 0 }} {{ end }}{{ $tag }}{{ end }}" />
        <p class="light">
          Existing tags: {{ range $i, $tag := .Payload.Tags }}{{ if ne $i 0 }} {{ end }}{{ $tag }}{{ end }}
        </p>
      </div>

      <div class="columns three">
        <label for="seriesInput">Series</label>
        <input
            id="seriesInput"
            name="series"
            class="u-full-width"
            type="text"
            value="{{ .Payload.Post.Series }}" />
      </div>

    </div>

    <div class="row">

      <div class="columns six">
        <label for="titleInput">Title</label>
        <input
            id="titleInput"
            name="title"
            class="u-full-width"
            type="text"
            value="{{ .Payload.Post.Title }}" />
      </div>

      <div class="columns six">
        <label for="descrInput">Description</label>
        <input
            id="descrInput"
            name="description"
            class="u-full-width"
            type="text"
            value="{{ .Payload.Post.Description }}" />
      </div>

    </div>

    <div class="row">
      <div class="columns twelve">
       <textarea
         name="body"
         class="u-full-width"
         placeholder="Blog body"
         style="height: 50vh;"
         >
         {{- .Payload.Post.Body -}}
       </textarea>
      </div>
    </div>

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

    <input type="submit" value="Save" formaction="{{ BlogURL "posts/" }}" />

    <a href="{{ BlogURL "posts/" }}">
      <button type="button">Cancel</button>
    </a>

  </form>

{{ end }}

{{ template "base.html" . }}