all repos — nirvash @ main

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

{{ template "header" . }}

<h2>Configuration</h2>

  <details class="ui_win uploader" id="theme_accordion"><summary>theme</summary>
      <form id="theme_cfg" onsubmit="return false">
        <label class="nohover">bg color<input type="color" id="bg_col_input"/></label>
        <label class="nohover">bg opacity<input type="range" id="bg_col_opacity" min="0" max="255"/></label>
        <label class="nohover">fg color<input type="color" id="fg_col_input"/></label>
        <label class="nohover">fg opacity<input type="range" id="fg_col_opacity" min="0" max="255"/></label>
        <label class="nohover">main color<input type="color" id="main_col_input"/></label>
        <label class="nohover">main opacity<input type="range" id="main_col_opacity" min="0" max="255"/></label>
        <label class="nohover">sub color<input type="color" id="sub_col_input"/></label>
        <label class="nohover">sub opacity<input type="range" id="sub_col_opacity" min="0" max="255"/></label>
        <label class="nohover">error color<input type="color" id="err_col_input"/></label>
        <label class="nohover">error opacity<input type="range" id="err_col_opacity" min="0" max="255"/></label>
        
        
        <div class="upload-wrapper">
  <label for="login-upload">Set Login BG</label><br/>
  <input type="file" id="login_bg_upload" name="file"/>
  </div>
  

        <button onclick="setTheme()">Apply</button>
          <div class="upload-wrapper">
  <label for="main-upload">Set Main BG</label><br/>
  <input type="file" id="main_bg_upload" name="file"/>
  </div><button onclick="resetTheme(defaultTheme, true)">Reset</button>
      </form>
    </details>

<form class="configurator" method="POST" action="/config-set">
<input hidden type="text" name="csrfToken" value="{{$csrfToken}}"/>
  {{ range $opt, $val := $config }}
    {{ if eq ($opt).Type "bool" }}
        <input type="hidden" name="{{($opt).Name}}:{{($opt).Type}}" value="0"/>
        <label> {{($opt).Name}} <input type="checkbox" name="{{($opt).Name}}:{{($opt).Type}}" {{ if ne $val "0"  }}checked{{end}} value="1"/></label><br/>
    {{ end }}
  {{ end }}
  {{ 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/>
    {{ end }}
  {{ end }}
  {{ range $opt, $val := $config }}
    {{ if eq ($opt).Type "float" }}
        <label>{{($opt).Name}} <input type="number" step="0.00000001" name="{{($opt).Name}}:{{($opt).Type}}" value="{{$val}}"/></label><br/>
    {{ end }}
  {{ end }}
  {{ range $opt, $val := $config }}
    {{ if eq ($opt).Type "string" }}
        <label>{{($opt).Name}} <input type="text" name="{{($opt).Name}}:{{($opt).Type}}" value="{{$val}}"/></label><br/>
    {{ end }}
  {{ end }}
  {{ range $opt, $val := $config }}
    {{ 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" . }}