Fix .js on removed comments. Removed duplicate post_comment
This commit is contained in:
parent
b87df9db36
commit
09c84030b5
2 changed files with 11 additions and 48 deletions
|
@ -144,44 +144,6 @@ function delete_commentModal(id) {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
post_comment=function(fullname){
|
|
||||||
|
|
||||||
|
|
||||||
var form = new FormData();
|
|
||||||
|
|
||||||
form.append('formkey', formkey());
|
|
||||||
form.append('parent_fullname', fullname);
|
|
||||||
form.append('submission', document.getElementById('reply-form-submission-'+fullname).value);
|
|
||||||
form.append('body', document.getElementById('reply-form-body-'+fullname).value);
|
|
||||||
form.append('file', document.getElementById('file-upload-reply-'+fullname).files[0]);
|
|
||||||
var xhr = new XMLHttpRequest();
|
|
||||||
xhr.open("post", "/comment");
|
|
||||||
xhr.withCredentials=true;
|
|
||||||
xhr.onload=function(){
|
|
||||||
if (xhr.status==200) {
|
|
||||||
commentForm=document.getElementById('comment-form-space-'+fullname);
|
|
||||||
commentForm.innerHTML=JSON.parse(xhr.response)["html"];
|
|
||||||
var myToast = new bootstrap.Toast(document.getElementById('toast-post-error'));
|
|
||||||
myToast.hide();
|
|
||||||
var myToast = new bootstrap.Toast(document.getElementById('toast-post-success'));
|
|
||||||
myToast.show();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
var commentError = document.getElementById("comment-error-text");
|
|
||||||
var myToast = new bootstrap.Toast(document.getElementById('toast-post-success'));
|
|
||||||
myToast.hide();
|
|
||||||
var myToast = new bootstrap.Toast(document.getElementById('toast-post-error'));
|
|
||||||
myToast.show();
|
|
||||||
commentError.textContent = JSON.parse(xhr.response)["error"];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
xhr.send(form)
|
|
||||||
|
|
||||||
document.getElementById('save-reply-to-'+fullname).classList.add('disabled');
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
post_reply=function(id){
|
post_reply=function(id){
|
||||||
|
|
||||||
var form = new FormData();
|
var form = new FormData();
|
||||||
|
@ -248,7 +210,7 @@ comment_edit=function(id){
|
||||||
}
|
}
|
||||||
xhr.send(form)
|
xhr.send(form)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
post_comment=function(fullname, postId){
|
post_comment=function(fullname, postId){
|
||||||
|
|
||||||
|
@ -259,6 +221,7 @@ post_comment=function(fullname, postId){
|
||||||
form.append('submission', document.getElementById('reply-form-submission-'+fullname).value);
|
form.append('submission', document.getElementById('reply-form-submission-'+fullname).value);
|
||||||
form.append('body', document.getElementById('reply-form-body-'+fullname).value);
|
form.append('body', document.getElementById('reply-form-body-'+fullname).value);
|
||||||
form.append('file', document.getElementById('file-upload-reply-'+fullname).files[0]);
|
form.append('file', document.getElementById('file-upload-reply-'+fullname).files[0]);
|
||||||
|
|
||||||
var xhr = new XMLHttpRequest();
|
var xhr = new XMLHttpRequest();
|
||||||
xhr.open("post", "/comment");
|
xhr.open("post", "/comment");
|
||||||
xhr.withCredentials=true;
|
xhr.withCredentials=true;
|
||||||
|
|
|
@ -518,8 +518,6 @@
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
(() => {
|
(() => {
|
||||||
const date = new Date('{{c.created_datetime}}');
|
const date = new Date('{{c.created_datetime}}');
|
||||||
|
@ -527,6 +525,8 @@
|
||||||
})()
|
})()
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
||||||
{% for comment in comments %}
|
{% for comment in comments %}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue