nirvash/templates/config.html

66 lines
3.1 KiB
HTML
Raw Normal View History

2022-06-08 05:44:54 +00:00
{{ $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>
<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="setTheme()">Apply</button><button onclick="resetTheme(defaultTheme)">Reset</button>
</form>
</details>
2022-06-08 05:44:54 +00:00
<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 }}
2022-06-08 05:44:54 +00:00
{{ 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/>
2022-06-08 05:49:47 +00:00
{{ end }}
{{ end }}
{{ range $opt, $val := $config }}
{{ if eq ($opt).Type "float" }}
2022-06-08 05:44:54 +00:00
<label>{{($opt).Name}} <input type="number" step="0.00000001" name="{{($opt).Name}}:{{($opt).Type}}" value="{{$val}}"/></label><br/>
2022-06-08 05:49:47 +00:00
{{ end }}
{{ end }}
{{ range $opt, $val := $config }}
{{ if eq ($opt).Type "string" }}
2022-06-08 05:44:54 +00:00
<label>{{($opt).Name}} <input type="text" name="{{($opt).Name}}:{{($opt).Type}}" value="{{$val}}"/></label><br/>
2022-06-08 05:49:47 +00:00
{{ end }}
{{ end }}
{{ range $opt, $val := $config }}
{{ if eq ($opt).Type "multilinestring" }}
2022-06-08 05:44:54 +00:00
<label>{{($opt).Name}} <textarea name="{{($opt).Name}}:{{($opt).Type}}">{{$val}}</textarea></label><br/>
2022-06-08 05:49:47 +00:00
{{ end }}
2022-06-08 05:44:54 +00:00
{{ end }}
<input type="submit" value="Save"/>
</form>
{{ template "footer" . }}