From 9399b89e34f7263b64f49035d8a86e8fd6e896f0 Mon Sep 17 00:00:00 2001 From: Pierre Date: Thu, 25 Jan 2018 06:58:26 +0100 Subject: [PATCH] Added edit comment button. --- assets/css/components/comments/ui.css | 6 ++++-- assets/js/components/comments/ui.js | 21 +++++++++++++++++++-- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/assets/css/components/comments/ui.css b/assets/css/components/comments/ui.css index e41d2580..2b978a2b 100644 --- a/assets/css/components/comments/ui.css +++ b/assets/css/components/comments/ui.css @@ -18,11 +18,13 @@ float: none; } -.post-comments .delete-comment-link { +.post-comments .delete-comment-link, +.post-comments .edit-comment-link { margin-left: 5px; color: #b5bbc8; } -.post-comments .delete-comment-link:active { +.post-comments .delete-comment-link:active, +.post-comments .edit-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 dfd15cbc..1b021d6e 100644 --- a/assets/js/components/comments/ui.js +++ b/assets/js/components/comments/ui.js @@ -110,9 +110,26 @@ 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 + //Offer the user the possibility to delete and update the comment if he is allowed to do so if(userID() == infos.userID){ + //Create a button to update the comment + var editCommentLink = createElem2({ + appendTo: rightContener, + type: "a", + class: "edit-comment-link" + }); + + createElem2({ + appendTo: deleteCommentLink, + type: "i", + class: "fa fa-edit" + }); + + //Make edit button lives + //Open in editor (separate file) + + //Create a button to delete the comment var deleteCommentLink = createElem2({ appendTo: rightContener, @@ -126,7 +143,7 @@ ComunicWeb.components.comments.ui = { class: "fa fa-trash" }); - //Make button lives + //Make delete button lives deleteCommentLink.onclick = function(){ ComunicWeb.common.messages.confirm("Are you sure do you want to delete this comment ? This operation is unrecoverable!", function(response){