From dfce597139873dd203aac4b14f8379360db27cf4 Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Wed, 4 Jul 2018 16:20:00 +0200 Subject: [PATCH] Can update group visibility --- assets/js/pages/groups/pages/settings.js | 50 +++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/assets/js/pages/groups/pages/settings.js b/assets/js/pages/groups/pages/settings.js index e4004a44..a6dcc2c3 100644 --- a/assets/js/pages/groups/pages/settings.js +++ b/assets/js/pages/groups/pages/settings.js @@ -99,6 +99,7 @@ ComunicWeb.pages.groups.pages.settings = { class: "group-settings-form" }); + //Group ID (not editable) createFormGroup({ target: formContainer, @@ -108,6 +109,7 @@ ComunicWeb.pages.groups.pages.settings = { disabled: true }); + //Group name var groupName = createFormGroup({ target: formContainer, @@ -117,6 +119,51 @@ ComunicWeb.pages.groups.pages.settings = { value: settings.name, }); + + //Group visibility + createElem2({ + appendTo: formContainer, + type: "label", + innerHTML: "Group visibility" + }); + + var visibilityForm = createElem2({ + type: "form", + appendTo: formContainer + }); + + //Open + createFormGroup({ + target: visibilityForm, + label: "Open Group (accessible to everyone)", + name: "group-visibility", + type: "radio", + value: "open", + checked: settings.visibility == "open" + }); + + //Private + createFormGroup({ + target: visibilityForm, + label: "Private Group (accessible to accepted members only)", + name: "group-visibility", + type: "radio", + value: "private", + checked: settings.visibility == "private" + }); + + //Secret + createFormGroup({ + target: visibilityForm, + label: "Secrete Group (accessible only to invited members)", + name: "group-visibility", + type: "radio", + value: "secrete", + checked: settings.visibility == "secrete" + }); + + + //Submit button var submitButtonContainer = createElem2({ appendTo: formContainer, @@ -146,7 +193,8 @@ ComunicWeb.pages.groups.pages.settings = { //Prepare the update request on the server var settings = { - name: groupName.value + name: groupName.value, + visibility: visibilityForm.elements["group-visibility"].value }; //Lock the send button