all repos — nirvash @ 37d184b3e228e0b43aa54fb45275131f46540229

modular CMS using the quartzgun library

templates/config.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
{{ $config := ((.Context).Value "adapter").GetConfig }}
{{ $csrfToken := (.Context).Value "csrfToken" }}

{{ template "header" . }}

<h2>Configuration</h2>

<form class="configurator" method="POST" action="/config-set">
<input hidden type="text" name="csrfToken" value="{{$csrfToken}}"/>
  {{ range $opt, $val := $config }}
    {{ if eq ($opt).Type "int" }}
        <label>{{($opt).Name}} <input type="number" step="1" name="{{($opt).Name}}:{{($opt).Type}}" value="{{$val}}"/></label><br/>
    {{ else if eq ($opt).Type "float" }}
        <label>{{($opt).Name}} <input type="number" step="0.00000001" name="{{($opt).Name}}:{{($opt).Type}}" value="{{$val}}"/></label><br/>
    {{ else if eq ($opt).Type "string" }}
        <label>{{($opt).Name}} <input type="text" name="{{($opt).Name}}:{{($opt).Type}}" value="{{$val}}"/></label><br/>
    {{ else if eq ($opt).Type "multilinestring" }}
        <label>{{($opt).Name}} <textarea name="{{($opt).Name}}:{{($opt).Type}}">{{$val}}</textarea></label><br/>
    {{ end}}
   
  {{ end }}
<input type="submit" value="Save"/>
</form>

{{ template "footer" . }}