mirror of
https://github.com/pierre42100/ComunicWeb
synced 2025-06-21 13:25:16 +00:00
Retrieve group settings on the API
This commit is contained in:
@ -21,7 +21,7 @@ ComunicWeb.pages.groups.pages.group = {
|
||||
if(result.error){
|
||||
|
||||
//Check the code of the error
|
||||
if(result.error.code == 404){
|
||||
if(result.error.code == 401){
|
||||
need_auth;//TODO : implement
|
||||
}
|
||||
|
||||
|
87
assets/js/pages/groups/pages/settings.js
Normal file
87
assets/js/pages/groups/pages/settings.js
Normal file
@ -0,0 +1,87 @@
|
||||
/**
|
||||
* Page settings
|
||||
*
|
||||
* @author Pierre HUBERT
|
||||
*/
|
||||
|
||||
ComunicWeb.pages.groups.pages.settings = {
|
||||
|
||||
/**
|
||||
* Open group settings page
|
||||
*
|
||||
* @param {Number} id The ID of the settings page
|
||||
* @param {HTMLElement} target The target of the page
|
||||
*/
|
||||
open: function(id, target){
|
||||
|
||||
//Create settings container
|
||||
var settingsContainer = createElem2({
|
||||
appendTo: target,
|
||||
type: "div",
|
||||
class: "group-settings-container col-md-6"
|
||||
});
|
||||
|
||||
//Add title
|
||||
createElem2({
|
||||
appendTo: settingsContainer,
|
||||
type: "h2",
|
||||
class: "title",
|
||||
innerHTML: "Group settings"
|
||||
});
|
||||
|
||||
//Display loading message
|
||||
var loadingMsg = ComunicWeb.common.messages.createCalloutElem(
|
||||
"Loading",
|
||||
"Please wait while we retrieve the settings of the page...",
|
||||
"info");
|
||||
settingsContainer.appendChild(loadingMsg);
|
||||
|
||||
//Get the settings of the page
|
||||
ComunicWeb.components.groups.interface.getSettings(id, function(result){
|
||||
|
||||
//Remove loading message
|
||||
loadingMsg.remove();
|
||||
|
||||
//Check for error
|
||||
if(result.error){
|
||||
|
||||
//Check if the user is not authorized to access the page
|
||||
if(result.error.code == 401){
|
||||
//The user is not authorized to see this page
|
||||
settingsContainer.appendChild(ComunicWeb.common.messages.createCalloutElem(
|
||||
"Access forbidden",
|
||||
"You are not authorized to access these information !",
|
||||
"danger"
|
||||
));
|
||||
}
|
||||
|
||||
//Else the page was not found
|
||||
else {
|
||||
settingsContainer.remove();
|
||||
ComunicWeb.common.error.pageNotFound({}, target);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
else {
|
||||
//Display settings pages
|
||||
ComunicWeb.pages.groups.pages.settings.display(id, result, target);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Display page settings
|
||||
*
|
||||
* @param {Number} id The ID of the target page
|
||||
* @param {Object} settings The settings of the page
|
||||
* @param {HTMLElement} target The target of the page
|
||||
*/
|
||||
display: function(id, settings, target){
|
||||
|
||||
alert(settings);
|
||||
|
||||
},
|
||||
}
|
Reference in New Issue
Block a user