micrach/templates/components/post-form.html

50 lines
1.7 KiB
HTML
Raw Permalink Normal View History

{{ define "post-form" }}
<div class="d-flex justify-content-center">
<div class="col col-lg-6 col-md-8">
{{ if eq .FirstPostID 0 }}
<form id="postForm" action="/" method="POST" enctype="multipart/form-data">
{{ else }}
<form id="postForm" action="/{{ .FirstPostID }}" method="POST" enctype="multipart/form-data">
{{ end }}
{{ if eq .FirstPostID 0 }}
2022-04-12 11:39:02 +03:00
<label class="form-error-label" for="title">{{ .Errors.Title }}</label>
2022-04-13 09:38:15 +03:00
<input class="form-control" id="postTitle" placeholder="Title" name="title" value={{ .Inputs.Title }}>
{{ end }}
2022-04-12 11:39:02 +03:00
<label class="form-error-label" for="text">{{ .Errors.Text }}</label>
2022-04-13 09:38:15 +03:00
<textarea class="form-control" id="postText" rows="5" placeholder="Text" name="text">{{ .Inputs.Text }}</textarea>
2022-04-12 11:39:02 +03:00
<label class="form-error-label" for="files">{{ .Errors.Files }}</label>
2022-04-13 09:38:15 +03:00
<input class="form-control" type="file" id="postFiles" multiple name="files" accept="image/jpeg, image/png"}>
{{ if .IsCaptchaActive }}
{{ template "captcha" .CaptchaID }}
{{ end }}
2022-04-12 11:39:02 +03:00
<div class="row mb-4">
{{ if ne .FirstPostID 0 }}
<div class="col">
<input class="form-check-input" type="checkbox" value="on" id="postSage" name="sage">
<label class="form-check-label" for="postSage">
Sage
</label>
</div>
{{ end }}
<div class="col text-end">
<button class="col btn btn-outline-primary" type="submit" >
{{ if ne .FirstPostID 0 }}
Send
{{ else }}
Create thread
{{ end }}
</button>
</div>
</div>
</form>
</div>
</div>
{{ end }}