Fixed comments

This commit is contained in:
Kenneth Jao 2016-09-02 00:34:40 -04:00
parent fabe20ddfe
commit 7eebae2b9f
3 changed files with 8 additions and 9 deletions

View File

@ -802,7 +802,7 @@ input, textarea {
#comment {
width: 105%;
position: relative;
overflow-y: scroll;
overflow-y: auto;
}
.commentBox {

View File

@ -676,6 +676,7 @@ Template.main.events({
var input = document.getElementById('workComment');
comment = input.value;
input.value = "";
Session.set("commentRestrict",null);
if (comment !== "") {
document.getElementById('workComment').value = "";
Meteor.call('addComment', [comment, workId], function(err,result) {
@ -702,18 +703,16 @@ Template.main.events({
sendData("deleteWork");
closeDivFade(document.getElementsByClassName("overlay")[0]);
},
'keydown #workComment' (event) { // Restrict length on comment.
var chars = event.target.value.length;
'keyup #workComment' (event) { // Restrict length on comment.
var chars = 200-event.target.value.length;
document.getElementById("commentRestrict").style.color = "#7E7E7E";
if(chars === 0) { // Don't display if nothing in comment.
if(chars === 200) { // Don't display if nothing in comment.
Session.set("commentRestrict","");
return;
}
if(chars === 200) {
} else if(chars === 0) {
document.getElementById("commentRestrict").style.color = "#FF1A1A"; // Make text red if 0 characters left.
}
Session.set("commentRestrict", "Characters left: " + (200-chars).toString());
Session.set("commentRestrict", "Characters left: " + chars.toString());
},
'click #markDone' () { // Click done button.

View File

@ -392,7 +392,7 @@ Meteor.methods({
var foundsubs = currentclass.subscribers;
if (typeof comment === "string" && comment.length <= 200 &&
_.contains(foundsubs, Meteor.userId()) &&
_.contains(currentclass.banned, Meteor.userId())) {
!_.contains(currentclass.banned, Meteor.userId())) {
var commentInfo = {
"comment": input[0],
"user": user,