From 825f88fe8e27dc940d22f7320d02e1ad4ecdfc14 Mon Sep 17 00:00:00 2001 From: Pierre Date: Wed, 10 Jan 2018 20:29:34 +0100 Subject: [PATCH] Added delete button --- assets/css/components/posts/ui.css | 25 +++++++++++++++++++++++-- assets/js/components/posts/ui.js | 23 +++++++++++++++++++---- 2 files changed, 42 insertions(+), 6 deletions(-) diff --git a/assets/css/components/posts/ui.css b/assets/css/components/posts/ui.css index 4065550d..0fa2437e 100644 --- a/assets/css/components/posts/ui.css +++ b/assets/css/components/posts/ui.css @@ -4,12 +4,33 @@ * @author Pierre HUBERT */ +/** + * Top right actions + */ +.post .top-right-buttons div { + display: inline-block; + padding-right: 10px; +} + +.post .top-right-buttons div .btn-group { + padding-right: 0px; +} + /** * For the visibility */ - .post .visibility .read-only { +.post .visibility .read-only { color: #b5bbc8; - padding-right: 10px; +} + +/** + * Posts deletion + */ +.post .del-post-div a { + color: #b5bbc8; +} +.post .del-post-div a:active { + color: black; } /** diff --git a/assets/js/components/posts/ui.js b/assets/js/components/posts/ui.js index 9119b718..c9daaf76 100644 --- a/assets/js/components/posts/ui.js +++ b/assets/js/components/posts/ui.js @@ -75,8 +75,8 @@ ComunicWeb.components.posts.ui = { var topRightArea = createElem2({ insertAsFirstChild: userBlock, type: "div", - class: "pull-right", - }) + class: "pull-right top-right-buttons", + }); //Load informations about visibility var visibilityTarget = createElem2({ @@ -93,8 +93,6 @@ ComunicWeb.components.posts.ui = { if(infos.user_access != "full"){ //The user can't change the visibility level of the post - - //Display visibility level as a simple icon createElem2({ appendTo: visibilityTarget, @@ -170,6 +168,23 @@ ComunicWeb.components.posts.ui = { } + //Add a button to delete the post if the user is allowed + if(infos.user_access == "full" || infos.user_access == "intermediate"){ + + var deleteButtonDiv = createElem2({ + appendTo: topRightArea, + type: "div", + class: "del-post-div" + }); + + var deleteButtonLink = createElem2({ + appendTo: deleteButtonDiv, + type: "a", + innerHTML: "" + }); + + } + //Add post attachement (if any) if(infos.kind == "text"){ //Do nothing