feat: make form responsible for different screens

This commit is contained in:
Yanislav Igonin 2021-10-04 19:49:44 +03:00
parent 19a2c02e9a
commit fcc6330b19

View File

@ -64,47 +64,50 @@
{{ end }} {{ end }}
{{ define "post-form" }} {{ define "post-form" }}
<div class="col col-12"> <div class="d-flex justify-content-center">
{{ 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 }}
<div class="col col-lg-6 col-md-8">
{{ if eq .FirstPostID 0 }} {{ if eq .FirstPostID 0 }}
<input class="form-control" id="postTitle" placeholder="Title" name="title"> <form id="postForm" action="/" method="POST" enctype="multipart/form-data">
{{ else }}
<form id="postForm" action="/{{ .FirstPostID }}" method="POST" enctype="multipart/form-data">
{{ end }} {{ end }}
<textarea class="form-control" id="postText" rows="5" placeholder="Text" name="text"></textarea> {{ if eq .FirstPostID 0 }}
<input class="form-control" type="file" id="postFiles" multiple name="files"> <input class="form-control" id="postTitle" placeholder="Title" name="title">
<div class="captcha-container text-center">
<img src="/captcha/{{ .CaptchaID }}" alt="Captcha">
</div>
<input class="form-control" type="hidden" id="postCaptcha" name="captchaId" value="{{ .CaptchaID }}">
<input class="form-control" id="postCaptcha" placeholder="Captcha" name="captcha">
<div class="row">
{{ if ne .FirstPostID 0 }}
<div class="col">
<input class="form-check-input" type="checkbox" value="" id="postSage" name="sage">
<label class="form-check-label" for="postSage">
Sage
</label>
</div>
{{ end }} {{ end }}
<div class="col text-end"> <textarea class="form-control" id="postText" rows="5" placeholder="Text" name="text"></textarea>
<button class="col btn btn-outline-primary" type="submit" > <input class="form-control" type="file" id="postFiles" multiple name="files">
{{ if ne .FirstPostID 0 }}
Send <div class="captcha-container text-center">
{{ else }} <img src="/captcha/{{ .CaptchaID }}" alt="Captcha">
Create thread
{{ end }}
</button>
</div> </div>
</div> <input class="form-control" type="hidden" id="postCaptcha" name="captchaId" value="{{ .CaptchaID }}">
</form> <input class="form-control" id="postCaptcha" placeholder="Captcha" name="captcha">
<div class="row">
{{ if ne .FirstPostID 0 }}
<div class="col">
<input class="form-check-input" type="checkbox" value="" 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> </div>
{{ end }} {{ end }}