Can update group registration level.

This commit is contained in:
Pierre HUBERT 2018-07-05 08:03:45 +02:00
parent 7db41a9183
commit 3bda514879

View File

@ -120,6 +120,7 @@ ComunicWeb.pages.groups.pages.settings = {
}); });
//Group visibility //Group visibility
createElem2({ createElem2({
appendTo: formContainer, appendTo: formContainer,
@ -153,7 +154,7 @@ ComunicWeb.pages.groups.pages.settings = {
}); });
//Secret //Secret
createFormGroup({ var secreteGroup = createFormGroup({
target: visibilityForm, target: visibilityForm,
label: "Secrete Group (accessible only to invited members)", label: "Secrete Group (accessible only to invited members)",
name: "group-visibility", name: "group-visibility",
@ -164,6 +165,55 @@ ComunicWeb.pages.groups.pages.settings = {
//Group registration levels
var registrationLevelForm = createElem2({
appendTo: formContainer,
type: "form",
});
createElem2({
appendTo: registrationLevelForm,
type: "label",
innerHTML: "Registration level"
});
//Open
createFormGroup({
target: registrationLevelForm,
label: "Open registration (anyone can join the group as member)",
name: "group-registration-level",
type: "radio",
value: "open",
checked: settings.registration_level == "open"
});
//Moderated
createFormGroup({
target: registrationLevelForm,
label: "Moderated registration (anyone can request a membership, but a moderator must review the request)",
name: "group-registration-level",
type: "radio",
value: "moderated",
checked: settings.registration_level == "moderated"
});
//Closed registration (required for secret groups)
var closedRegistration = createFormGroup({
target: registrationLevelForm,
label: "Closed registration (the only way to join the group is to be invited by a moderator)",
name: "group-registration-level",
type: "radio",
value: "closed",
checked: settings.registration_level == "closed"
});
//Make sure secret group have closed registration
$(secreteGroup).on("ifChanged", function(){
if(secreteGroup.checked){
$(closedRegistration).iCheck("check");
}
});
//Submit button //Submit button
var submitButtonContainer = createElem2({ var submitButtonContainer = createElem2({
appendTo: formContainer, appendTo: formContainer,
@ -194,7 +244,8 @@ ComunicWeb.pages.groups.pages.settings = {
//Prepare the update request on the server //Prepare the update request on the server
var settings = { var settings = {
name: groupName.value, name: groupName.value,
visibility: visibilityForm.elements["group-visibility"].value visibility: visibilityForm.elements["group-visibility"].value,
registration_level: registrationLevelForm.elements["group-registration-level"].value
}; };
//Lock the send button //Lock the send button
@ -216,6 +267,9 @@ ComunicWeb.pages.groups.pages.settings = {
}); });
/** /**
* Group account image * Group account image
*/ */