fix hidden config options

This commit is contained in:
Iris Lightshard 2024-11-10 10:50:56 -07:00
parent 30c3a2c4b4
commit ca951a7ef7
Signed by: Iris Lightshard
GPG key ID: 688407174966CAF3
2 changed files with 42 additions and 11 deletions

View file

@ -191,7 +191,27 @@ func (self *EurekaAdapter) FormattingHelp() string {
{.heading text} {.heading text}
// shorthand for publish date (renders as <time class='publish-date'>) // shorthand for publish date (renders as <time class='publish-date'>)
{+2022-02-22}` {+2022-02-22}
// shorthand for tables
{[column 1 header|column 2 header|column 3 header}
{|simple data|{@bold data}|{*https://nilfm.cc|link data}}
{|more|and more|and more data!}
{;}
// shorthand for publish date (renders as <time class='publish-date'>)
{+2022-02-22}
// shorthand for explicit monospace, sans, and serif font respecively:
{=some mono text}
{(some sans serif text}
{)some serif text}
// shorthand for a pictured directory/list item
{%page name|picture}
// shorthand for a shop listing
{^payment-link|description|img1|alttext1|...|imgn|alttextn}`
} }
func (self *EurekaAdapter) CreatePage(slug, title, content string) error { func (self *EurekaAdapter) CreatePage(slug, title, content string) error {

View file

@ -35,40 +35,51 @@
<form class="configurator" method="POST" action="/config-set"> <form class="configurator" method="POST" action="/config-set">
<input hidden type="text" name="csrfToken" value="{{$csrfToken}}"/> <input hidden type="text" name="csrfToken" value="{{$csrfToken}}"/>
<!-- we iterate over the config multiple times as an inefficient method to sort the options by type -->
{{ range $opt, $val := $config }} {{ range $opt, $val := $config }}
{{ if ne ($opt).Hidden true }}
{{ if eq ($opt).Type "bool" }} {{ if eq ($opt).Type "bool" }}
{{ if ne ($opt).Hidden true }}
<input type="hidden" name="{{($opt).Name}}:{{($opt).Type}}" value="0"/> <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/> <label> {{($opt).Name}} <input type="checkbox" name="{{($opt).Name}}:{{($opt).Type}}" {{ if ne $val "0" }}checked{{end}} value="1"/></label><br/>
{{ end }} {{ else }}
<input type="hidden" name="{{($opt).Name}}:{{($opt).Type}}" value="{{ $val }}"/>
{{ end }}
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ range $opt, $val := $config }} {{ range $opt, $val := $config }}
{{ if ne ($opt).Hidden true }}
{{ if eq ($opt).Type "int" }} {{ if eq ($opt).Type "int" }}
{{ if ne ($opt).Hidden true }}
<label>{{($opt).Name}} <input type="number" step="1" name="{{($opt).Name}}:{{($opt).Type}}" value="{{$val}}"/></label><br/> <label>{{($opt).Name}} <input type="number" step="1" name="{{($opt).Name}}:{{($opt).Type}}" value="{{$val}}"/></label><br/>
{{ end }} {{ else }}
<input type="hidden" name="{{($opt).Name}}:{{($opt).Type}}" value="{{ $val }}"/>
{{ end }}
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ range $opt, $val := $config }} {{ range $opt, $val := $config }}
{{ if ne ($opt).Hidden true }}
{{ if eq ($opt).Type "float" }} {{ if eq ($opt).Type "float" }}
{{ if ne ($opt).Hidden true }}
<label>{{($opt).Name}} <input type="number" step="0.00000001" name="{{($opt).Name}}:{{($opt).Type}}" value="{{$val}}"/></label><br/> <label>{{($opt).Name}} <input type="number" step="0.00000001" name="{{($opt).Name}}:{{($opt).Type}}" value="{{$val}}"/></label><br/>
{{ end }} {{ else }}
<input type="hidden" name="{{($opt).Name}}:{{($opt).Type}}" value="{{ $val }}"/>
{{ end }}
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ range $opt, $val := $config }} {{ range $opt, $val := $config }}
{{ if ne ($opt).Hidden true }}
{{ if eq ($opt).Type "string" }} {{ if eq ($opt).Type "string" }}
{{ if ne ($opt).Hidden true }}
<label>{{($opt).Name}} <input type="text" name="{{($opt).Name}}:{{($opt).Type}}" value="{{$val}}"/></label><br/> <label>{{($opt).Name}} <input type="text" name="{{($opt).Name}}:{{($opt).Type}}" value="{{$val}}"/></label><br/>
{{ end }} {{ else }}
<input type="hidden" name="{{($opt).Name}}:{{($opt).Type}}" value="{{ $val }}"/>
{{ end }}
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ range $opt, $val := $config }} {{ range $opt, $val := $config }}
{{ if ne ($opt).Hidden true }}
{{ if eq ($opt).Type "multilinestring" }} {{ if eq ($opt).Type "multilinestring" }}
{{ if ne ($opt).Hidden true }}
<label>{{($opt).Name}} <textarea name="{{($opt).Name}}:{{($opt).Type}}">{{$val}}</textarea></label><br/> <label>{{($opt).Name}} <textarea name="{{($opt).Name}}:{{($opt).Type}}">{{$val}}</textarea></label><br/>
{{ end }} {{ else }}
<input type="hidden" name="{{($opt).Name}}:{{($opt).Type}}" value="{{ $val }}"/>
{{ end }}
{{ end }} {{ end }}
{{ end }} {{ end }}
<input type="submit" value="Save"/> <input type="submit" value="Save"/>