2019-02-22 00:04:57 +01:00
|
|
|
{{define "form"}}
|
|
|
|
{{.PreFormHTML}}
|
2022-10-11 14:21:06 +02:00
|
|
|
<form class="highlight_border" method="POST">
|
2019-12-17 19:28:30 +01:00
|
|
|
{{if eq .Submitted true}}
|
|
|
|
{{if eq .SubmitSuccess true}}
|
|
|
|
<div id="submit_result" class="highlight_green">
|
|
|
|
{{index .SubmitMessages 0}}
|
|
|
|
</div>
|
|
|
|
{{else}}
|
|
|
|
<div id="submit_result" class="highlight_red">
|
|
|
|
<ul>
|
|
|
|
{{range $msg := .SubmitMessages}}
|
|
|
|
<li>{{$msg}}</li>
|
|
|
|
{{end}}
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
{{end}}
|
|
|
|
{{end}}
|
2019-02-25 22:53:09 +01:00
|
|
|
<input type="text" name="form" value="{{.Name}}" style="display: none;" readonly="readonly"/>
|
|
|
|
{{if ne .Username ""}}
|
|
|
|
<!-- The invisible username field is so browsers know which user the form was for -->
|
|
|
|
<input type="text" autocomplete="username" value="{{.Username}}" style="display: none;" readonly="readonly"/>
|
|
|
|
{{end}}
|
2022-08-04 20:19:30 +02:00
|
|
|
<div class="form">
|
2020-01-28 12:51:21 +01:00
|
|
|
{{range $field := .Fields}}
|
2022-08-04 20:19:30 +02:00
|
|
|
<label for="input_{{$field.Name}}">
|
|
|
|
{{$field.Label}}
|
|
|
|
</label>
|
|
|
|
{{if eq $field.Type "text"}}
|
|
|
|
<input id="input_{{$field.Name}}" name="{{$field.Name}}" value="{{$field.DefaultValue}}" type="text" class="form_input"/>
|
|
|
|
{{else if eq $field.Type "number"}}
|
|
|
|
<input id="input_{{$field.Name}}" name="{{$field.Name}}" value="{{$field.DefaultValue}}" type="number" class="form_input"/>
|
|
|
|
{{else if eq $field.Type "username"}}
|
|
|
|
<input id="input_{{$field.Name}}" name="{{$field.Name}}" value="{{$field.DefaultValue}}" type="text" autocomplete="username" class="form_input"/>
|
|
|
|
{{else if eq $field.Type "email"}}
|
|
|
|
<input id="input_{{$field.Name}}" name="{{$field.Name}}" value="{{$field.DefaultValue}}" type="email" autocomplete="email" class="form_input"/>
|
|
|
|
{{else if eq $field.Type "current-password"}}
|
|
|
|
<input id="input_{{$field.Name}}" name="{{$field.Name}}" value="{{$field.DefaultValue}}" type="password" autocomplete="current-password" class="form_input"/>
|
|
|
|
{{else if eq $field.Type "new-password"}}
|
|
|
|
<input id="input_{{$field.Name}}" name="{{$field.Name}}" value="{{$field.DefaultValue}}" type="password" autocomplete="new-password" class="form_input"/>
|
|
|
|
{{else if eq $field.Type "textarea"}}
|
|
|
|
<textarea id="input_{{$field.Name}}" name="{{$field.Name}}" class="form_input" style="width: 100%; height: 10em; resize: vertical;">{{$field.DefaultValue}}</textarea>
|
|
|
|
{{else if eq $field.Type "captcha"}}
|
|
|
|
<script src="https://www.google.com/recaptcha/api.js" async defer></script>
|
|
|
|
<div class="g-recaptcha" data-theme="dark" data-sitekey="{{$field.CaptchaSiteKey}}"></div>
|
|
|
|
{{else if eq $field.Type "radio"}}
|
|
|
|
{{ range $val := $field.RadioValues}}
|
|
|
|
<input
|
|
|
|
id="input_{{$field.Name}}_choice_{{$val}}"
|
|
|
|
name="{{$field.Name}}"
|
|
|
|
value="{{$val}}"
|
|
|
|
type="radio"
|
|
|
|
{{if eq $val $field.DefaultValue}}checked="checked"{{end}}/>
|
|
|
|
<label for="input_{{$field.Name}}_choice_{{$val}}">{{$val}}</label><br/>
|
|
|
|
{{ end }}
|
|
|
|
{{else if eq $field.Type "description"}}
|
|
|
|
{{$field.DefaultValue}}
|
2020-05-05 22:03:34 +02:00
|
|
|
{{end}}
|
2022-08-04 20:19:30 +02:00
|
|
|
{{if ne $field.Description ""}}
|
|
|
|
<div>
|
|
|
|
{{$field.Description}}
|
|
|
|
</div>
|
2019-02-22 00:04:57 +01:00
|
|
|
{{end}}
|
2022-08-04 20:19:30 +02:00
|
|
|
{{end}}
|
|
|
|
{{if eq .SubmitRed true}}
|
|
|
|
<button type="submit" class="button_red">
|
|
|
|
<i class="icon">send</i>
|
|
|
|
{{.SubmitLabel}}
|
|
|
|
</button>
|
|
|
|
{{else}}
|
|
|
|
<button type="submit" class="button_highlight">
|
|
|
|
<i class="icon">send</i>
|
|
|
|
{{.SubmitLabel}}
|
|
|
|
</button>
|
|
|
|
{{end}}
|
|
|
|
</div>
|
2019-02-22 00:04:57 +01:00
|
|
|
</form>
|
|
|
|
{{.PostFormHTML}}
|
|
|
|
{{end}}
|
|
|
|
{{define "form_page"}}
|
|
|
|
<!DOCTYPE html>
|
2020-01-17 20:32:21 +01:00
|
|
|
<html lang="en">
|
2019-02-22 00:04:57 +01:00
|
|
|
<head>
|
|
|
|
{{template "meta_tags" .Title}}
|
2020-01-17 20:32:21 +01:00
|
|
|
<script>var apiEndpoint = '{{.APIEndpoint}}';</script>
|
2019-02-22 00:04:57 +01:00
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
|
|
|
<div id='body' class="body">
|
2019-09-17 23:38:40 +02:00
|
|
|
{{template "page_top" .}}
|
2022-01-11 13:28:22 +01:00
|
|
|
<header>
|
2022-01-03 14:02:50 +01:00
|
|
|
<h1>{{.Form.Title}}</h1>
|
2022-01-11 13:28:22 +01:00
|
|
|
</header>
|
2022-10-11 14:21:06 +02:00
|
|
|
|
|
|
|
<div id="page_content" class="page_content">
|
2019-09-17 23:38:40 +02:00
|
|
|
<br/>
|
2022-10-11 14:21:06 +02:00
|
|
|
<section>
|
|
|
|
{{template "form" .Form}}
|
|
|
|
<br/>
|
|
|
|
</section>
|
|
|
|
</div>
|
2019-09-17 23:38:40 +02:00
|
|
|
{{template "page_bottom" .}}
|
2019-02-22 00:04:57 +01:00
|
|
|
</div>
|
|
|
|
|
|
|
|
{{template "analytics"}}
|
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
{{end}}
|