diff --git a/assets/js/components/posts/form.js b/assets/js/components/posts/form.js index ea1fc3f6..7559acdc 100644 --- a/assets/js/components/posts/form.js +++ b/assets/js/components/posts/form.js @@ -302,16 +302,28 @@ ComunicWeb.components.posts.form = { class: "post-visiblity-container" }); - if(kind != "group"){ + //For posts on users page + if(kind == "user"){ + //Private post var privateLevel = ComunicWeb.components.posts.visibilityLevels.private; 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 - var friendsLevel = ComunicWeb.components.posts.visibilityLevels.friends; - var friendsInput = this._add_visiblity_choice(visibility_choices_container, "friends", friendsLevel.name, friendsLevel.icon); - friendsInput.checked = true; + //For posts on groups page + if(kind == "group"){ + + //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 var publicLevel = ComunicWeb.components.posts.visibilityLevels.public; diff --git a/assets/js/components/posts/ui.js b/assets/js/components/posts/ui.js index 3b53dac3..edb2e82c 100644 --- a/assets/js/components/posts/ui.js +++ b/assets/js/components/posts/ui.js @@ -136,8 +136,18 @@ ComunicWeb.components.posts.ui = { }); //Process all visibility levels - var privateChoice = this._add_visibility_menu_item(visibilityDropdown, "private"); - var friendsChoice = this._add_visibility_menu_item(visibilityDropdown, "friends"); + //For pages only + 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 onVisibilityLevelChoice = function(){ @@ -167,8 +177,14 @@ ComunicWeb.components.posts.ui = { } //Set the items lives - privateChoice.onclick = onVisibilityLevelChoice; - friendsChoice.onclick = onVisibilityLevelChoice; + if(infos.user_page_id != 0){ + privateChoice.onclick = onVisibilityLevelChoice; + friendsChoice.onclick = onVisibilityLevelChoice; + } + + if(infos.group_id != 0) + membersChoice.onclick = onVisibilityLevelChoice; + publicChoice.onclick = onVisibilityLevelChoice; } diff --git a/assets/js/components/posts/visibilityLevels.js b/assets/js/components/posts/visibilityLevels.js index b4b9d307..69a2bb1c 100644 --- a/assets/js/components/posts/visibilityLevels.js +++ b/assets/js/components/posts/visibilityLevels.js @@ -28,6 +28,17 @@ ComunicWeb.components.posts.visibilityLevels = { name: "Friends" }, + /** + * Group members + */ + members: { + //Icon + icon: "fa-users", + + //Name + name: "Group members" + }, + /** * Public */