1
0
mirror of https://github.com/avinal/avinal.github.io.git synced 2026-07-04 07:40:09 +05:30

comment system update

Signed-off-by: Avinal Kumar <avinal.xlvii@gmail.com>
This commit is contained in:
2021-05-31 00:50:38 +05:30
parent 03cfbdc9b9
commit ae58867a18
+17 -10
View File
@@ -1,18 +1,19 @@
{% if FORM_COMMENTS %} {% if FORM_COMMENTS %}
<hr>
<div id="comment-form"> <div id="comment-form">
<div class="alert alert-info" role="alert"> <div class="alert alert-info" role="alert">
Feel free to leave a feedback or questions ! Feel free to leave a feedback or questions !
</div> </div>
<form id="comment-form" action="{{ FORM_PROPERTIES['action'] }}" target="response" method="POST"> <form action="{{ FORM_PROPERTIES['action'] }}" target="response" method="POST" id="valid-form">
<div class="form-row align-items-center"> <div class="form-row align-items-center">
<div class="form-group col-auto"> <div class="form-group col-md-5">
<label class="sr-only" for="person-name">Name</label> <label class="sr-only" for="person-name">Name</label>
<input type="text" class="form-control form-control-sm" id="person-name" placeholder="Your Name (Optional)" <input type="text" class="form-control form-control-sm" id="person-name" placeholder="Your Name (Optional)"
aria-describedby="nameHelp" name="{{ FORM_PROPERTIES['name'] }}"> aria-describedby="nameHelp" name="{{ FORM_PROPERTIES['name'] }}">
<input type="text" id="page-link" name="{{ FORM_PROPERTIES['link'] }}" hidden> <input type="text" id="page-link" name="{{ FORM_PROPERTIES['link'] }}" hidden>
<small id="nameHelp" class="form-text text-muted">You may put your GitHub Username.</small> <small id="nameHelp" class="form-text text-muted">You may put your GitHub Username.</small>
</div> </div>
<div class="form-group col"> <div class="form-group col-md-7">
<label class="sr-only" for="email-address">Email address</label> <label class="sr-only" for="email-address">Email address</label>
<input type="email" class="form-control form-control-sm" id="email-address" aria-describedby="emailHelp" <input type="email" class="form-control form-control-sm" id="email-address" aria-describedby="emailHelp"
placeholder="Your Email Address (Optional)" name="{{ FORM_PROPERTIES['email'] }}"> placeholder="Your Email Address (Optional)" name="{{ FORM_PROPERTIES['email'] }}">
@@ -25,9 +26,12 @@
<textarea class="form-control form-control-sm" id="comment-section" rows="3" <textarea class="form-control form-control-sm" id="comment-section" rows="3"
placeholder="Please enter your message or feedback. (Required)" aria-describedby="emailHelp" placeholder="Please enter your message or feedback. (Required)" aria-describedby="emailHelp"
name="{{ FORM_PROPERTIES['comment'] }}" required></textarea> name="{{ FORM_PROPERTIES['comment'] }}" required></textarea>
<div class="invalid-feedback">
Please Enter something !
</div>
<small id="textHelp" class="form-text text-muted">Enter upto 200 characters.</small> <small id="textHelp" class="form-text text-muted">Enter upto 200 characters.</small>
</div> </div>
<button class="btn btn-outline-info" onclick="return submitform()" type="submit">Send</button> <button class="btn btn-outline-info" type="submit">Send</button>
</form> </form>
<iframe name="response" hidden></iframe> <iframe name="response" hidden></iframe>
</div> </div>
@@ -37,13 +41,16 @@
soon if you have added an email.</p> soon if you have added an email.</p>
</div> </div>
<script> <script>
function submitform() { (function () {
var form = document.getElementById('comment-form'); 'use strict';
window.addEventListener('load', function () {
var form = document.getElementById('valid-form');
form.addEventListener('submit', function (event) {
document.getElementById('page-link').value = window.location.href; document.getElementById('page-link').value = window.location.href;
form.style.display = 'none'; document.getElementById('comment-form').style.display = 'none';
document.getElementById('comment-message').style.display = ''; document.getElementById('comment-message').style.display = '';
var submitted = form.submit(); }, false);
return false; }, false);
}; })();
</script> </script>
{% endif %} {% endif %}