Added delete comment button.

This commit is contained in:
Pierre 2018-01-23 06:41:17 +01:00
parent b8e76b05ff
commit 298d0b37d1
2 changed files with 28 additions and 1 deletions

View File

@ -17,3 +17,12 @@
height: auto !important; height: auto !important;
float: none; float: none;
} }
.post-comments .delete-comment-link {
margin-left: 5px;
color: #b5bbc8;
}
.post-comments .delete-comment-link:active {
color: black;
}

View File

@ -96,7 +96,7 @@ ComunicWeb.components.comments.ui = {
innerHTML: userFullName(user) innerHTML: userFullName(user)
}); });
//Add right text //Add right elements
var rightContener = createElem2({ var rightContener = createElem2({
appendTo: userNameContener, appendTo: userNameContener,
type: "span", type: "span",
@ -110,6 +110,24 @@ ComunicWeb.components.comments.ui = {
innerHTML: ComunicWeb.common.date.timeDiffToStr(infos.time_sent) + " ago" innerHTML: ComunicWeb.common.date.timeDiffToStr(infos.time_sent) + " ago"
}); });
//Offer the user the possibility to delete the comment if he is allowed to do so
if(userID() == infos.userID){
//Create a button to delete the comment
var deleteCommentLink = createElem2({
appendTo: rightContener,
type: "a",
class: "delete-comment-link"
});
createElem2({
appendTo: deleteCommentLink,
type: "i",
class: "fa fa-trash"
});
}
//Add comment content //Add comment content
var commentContent = createElem2({ var commentContent = createElem2({
appendTo: commentText, appendTo: commentText,