Added delete button

This commit is contained in:
Pierre 2018-01-10 20:29:34 +01:00
parent 741dd8b75c
commit 825f88fe8e
2 changed files with 42 additions and 6 deletions

View File

@ -4,12 +4,33 @@
* @author Pierre HUBERT * @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 * For the visibility
*/ */
.post .visibility .read-only { .post .visibility .read-only {
color: #b5bbc8; color: #b5bbc8;
padding-right: 10px; }
/**
* Posts deletion
*/
.post .del-post-div a {
color: #b5bbc8;
}
.post .del-post-div a:active {
color: black;
} }
/** /**

View File

@ -75,8 +75,8 @@ ComunicWeb.components.posts.ui = {
var topRightArea = createElem2({ var topRightArea = createElem2({
insertAsFirstChild: userBlock, insertAsFirstChild: userBlock,
type: "div", type: "div",
class: "pull-right", class: "pull-right top-right-buttons",
}) });
//Load informations about visibility //Load informations about visibility
var visibilityTarget = createElem2({ var visibilityTarget = createElem2({
@ -93,8 +93,6 @@ ComunicWeb.components.posts.ui = {
if(infos.user_access != "full"){ if(infos.user_access != "full"){
//The user can't change the visibility level of the post //The user can't change the visibility level of the post
//Display visibility level as a simple icon //Display visibility level as a simple icon
createElem2({ createElem2({
appendTo: visibilityTarget, 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: "<i class='fa fa-trash'></i>"
});
}
//Add post attachement (if any) //Add post attachement (if any)
if(infos.kind == "text"){ if(infos.kind == "text"){
//Do nothing //Do nothing