diff --git a/assets/css/components/comments/ui.css b/assets/css/components/comments/ui.css index 6cb542f4..e41d2580 100644 --- a/assets/css/components/comments/ui.css +++ b/assets/css/components/comments/ui.css @@ -16,4 +16,13 @@ width: 100px !important; height: auto !important; float: none; +} + +.post-comments .delete-comment-link { + margin-left: 5px; + color: #b5bbc8; +} + +.post-comments .delete-comment-link:active { + color: black; } \ No newline at end of file diff --git a/assets/js/components/comments/ui.js b/assets/js/components/comments/ui.js index af919d02..9e635979 100644 --- a/assets/js/components/comments/ui.js +++ b/assets/js/components/comments/ui.js @@ -96,7 +96,7 @@ ComunicWeb.components.comments.ui = { innerHTML: userFullName(user) }); - //Add right text + //Add right elements var rightContener = createElem2({ appendTo: userNameContener, type: "span", @@ -110,6 +110,24 @@ ComunicWeb.components.comments.ui = { 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 var commentContent = createElem2({ appendTo: commentText,