all repos — nirvash @ main

modular CMS using the quartzgun library

templates/cms_new.html (raw)

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
{{ $editableSlugs := ((.Context).Value "adapter").EditableSlugs }}
{{ $csrfToken := (.Context).Value "csrfToken" }}
{{ $noEmpty := .FormValue "no-empty" }}

{{ template "header" . }}

<h2>New Page</h2>

<form class="editor" method="POST" action="/create">
  {{ if $noEmpty }}
    <span class="edit-error">Empty fields are not allowed - please try again</span><br/>
  {{ end }}
  <input hidden name="csrfToken" value="{{$csrfToken}}"/>
  <label for="title">Title</label><br/>
  <input class="title-input" id="title" type="text" name="title" required/><br/>
  {{ if $editableSlugs }}
    <label for="slug">Slug</label><br/>
    <input class="slug-input" id="slug" type="text" name="slug" required/><br/>
  {{ end }}
  <label for="content">Content</label><br/>
  <textarea class="content-input" id="content" name="content" required></textarea><br/>
    <a target="_blank" class="fmt-help" href="/fmt-help">Formatting help</a>
  <input type="submit" value="Save"/>
</form>

{{ template "footer" . }}