Handles new kind of visibility level : members

This commit is contained in:
Pierre HUBERT 2018-07-17 09:58:04 +02:00
parent acb4e1b384
commit 059fcc72b6
3 changed files with 48 additions and 9 deletions

View File

@ -302,16 +302,28 @@ ComunicWeb.components.posts.form = {
class: "post-visiblity-container" class: "post-visiblity-container"
}); });
if(kind != "group"){ //For posts on users page
if(kind == "user"){
//Private post //Private post
var privateLevel = ComunicWeb.components.posts.visibilityLevels.private; var privateLevel = ComunicWeb.components.posts.visibilityLevels.private;
var privateInput = this._add_visiblity_choice(visibility_choices_container, "private", privateLevel.name, privateLevel.icon); var privateInput = this._add_visiblity_choice(visibility_choices_container, "private", privateLevel.name, privateLevel.icon);
//Friends-visible post
var friendsLevel = ComunicWeb.components.posts.visibilityLevels.friends;
var friendsInput = this._add_visiblity_choice(visibility_choices_container, "friends", friendsLevel.name, friendsLevel.icon);
friendsInput.checked = true;
} }
//Friends-visible post //For posts on groups page
var friendsLevel = ComunicWeb.components.posts.visibilityLevels.friends; if(kind == "group"){
var friendsInput = this._add_visiblity_choice(visibility_choices_container, "friends", friendsLevel.name, friendsLevel.icon);
friendsInput.checked = true; //Members-visible posts
var membersLevel = ComunicWeb.components.posts.visibilityLevels.friends;
var membersInput = this._add_visiblity_choice(visibility_choices_container, "members", membersLevel.name, membersLevel.icon);
membersInput.checked = true;
}
//Worldwide post //Worldwide post
var publicLevel = ComunicWeb.components.posts.visibilityLevels.public; var publicLevel = ComunicWeb.components.posts.visibilityLevels.public;

View File

@ -136,8 +136,18 @@ ComunicWeb.components.posts.ui = {
}); });
//Process all visibility levels //Process all visibility levels
var privateChoice = this._add_visibility_menu_item(visibilityDropdown, "private"); //For pages only
var friendsChoice = this._add_visibility_menu_item(visibilityDropdown, "friends"); if(infos.user_page_id != 0){
var privateChoice = this._add_visibility_menu_item(visibilityDropdown, "private");
var friendsChoice = this._add_visibility_menu_item(visibilityDropdown, "friends");
}
//For groups only
if(infos.group_id != 0){
var membersChoice = this._add_visibility_menu_item(visibilityDropdown, "members");
}
//Public
var publicChoice = this._add_visibility_menu_item(visibilityDropdown, "public"); var publicChoice = this._add_visibility_menu_item(visibilityDropdown, "public");
var onVisibilityLevelChoice = function(){ var onVisibilityLevelChoice = function(){
@ -167,8 +177,14 @@ ComunicWeb.components.posts.ui = {
} }
//Set the items lives //Set the items lives
privateChoice.onclick = onVisibilityLevelChoice; if(infos.user_page_id != 0){
friendsChoice.onclick = onVisibilityLevelChoice; privateChoice.onclick = onVisibilityLevelChoice;
friendsChoice.onclick = onVisibilityLevelChoice;
}
if(infos.group_id != 0)
membersChoice.onclick = onVisibilityLevelChoice;
publicChoice.onclick = onVisibilityLevelChoice; publicChoice.onclick = onVisibilityLevelChoice;
} }

View File

@ -28,6 +28,17 @@ ComunicWeb.components.posts.visibilityLevels = {
name: "Friends" name: "Friends"
}, },
/**
* Group members
*/
members: {
//Icon
icon: "fa-users",
//Name
name: "Group members"
},
/** /**
* Public * Public
*/ */