From b8e76b05ff7a8dcf240124dec5eecd6519ee08e9 Mon Sep 17 00:00:00 2001 From: Pierre Date: Mon, 22 Jan 2018 19:13:31 +0100 Subject: [PATCH] Display images associated with comments. --- assets/css/components/comments/ui.css | 12 ++++++++++- assets/js/components/comments/ui.js | 29 +++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/assets/css/components/comments/ui.css b/assets/css/components/comments/ui.css index a560a0fb..6cb542f4 100644 --- a/assets/css/components/comments/ui.css +++ b/assets/css/components/comments/ui.css @@ -4,6 +4,16 @@ * @author Pierre HUBERT */ -.post-comments{ +.post-comments { padding: 10px; +} + +.post-comments .comment-img-contener { + text-align: center; +} + +.post-comments img.comment-img { + width: 100px !important; + height: auto !important; + float: none; } \ No newline at end of file diff --git a/assets/js/components/comments/ui.js b/assets/js/components/comments/ui.js index 0e5d2c53..af919d02 100644 --- a/assets/js/components/comments/ui.js +++ b/assets/js/components/comments/ui.js @@ -118,6 +118,35 @@ ComunicWeb.components.comments.ui = { }); //Add comment image (if any) + if(infos.img_url != null){ + + var commentImageContener = createElem2({ + appendTo: commentText, + type: "div", + class: "comment-img-contener" + }); + + var commentImageLink = createElem2({ + appendTo: commentImageContener, + type: "a", + href: infos.img_url + }); + + createElem2({ + appendTo: commentImageLink, + type: "img", + class: "comment-img", + src: infos.img_url + }); + + commentImageLink.onclick = function(){ + $(this).ekkoLightbox({ + alwaysShowClose: true, + }); + return false; + } + + } }, } \ No newline at end of file