mirror of
https://github.com/pierre42100/ComunicWeb
synced 2024-11-22 20:19:21 +00:00
Upgraded request.
This commit is contained in:
parent
e8df43351f
commit
4860ee6623
@ -38,23 +38,43 @@ ComunicWeb.pages.groups.pages.main = {
|
|||||||
"info");
|
"info");
|
||||||
pageContainer.appendChild(message);
|
pageContainer.appendChild(message);
|
||||||
|
|
||||||
//Get the list of groups of the user
|
/**
|
||||||
ComunicWeb.components.groups.interface.getListUser(function(list){
|
* This function is used if an error occurs while retrieving the list
|
||||||
|
* of groups of the user
|
||||||
|
*/
|
||||||
|
var getListError = function(){
|
||||||
|
|
||||||
message.remove();
|
message.remove();
|
||||||
|
|
||||||
//Check for errors
|
pageContainer.appendChild(
|
||||||
if(list.error)
|
|
||||||
return pageContainer.appendChild(
|
|
||||||
ComunicWeb.common.messages.createCalloutElem(
|
ComunicWeb.common.messages.createCalloutElem(
|
||||||
"Error",
|
"Error",
|
||||||
"An error occurred while retrieving the list of groups of the user!",
|
"An error occurred while retrieving the list of groups of the user!",
|
||||||
"danger"
|
"danger"
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Get the list of groups of the user
|
||||||
|
ComunicWeb.components.groups.interface.getListUser(function(list){
|
||||||
|
|
||||||
|
//Check for errors
|
||||||
|
if(list.error)
|
||||||
|
return getListError();
|
||||||
|
|
||||||
|
//Get information about the groups
|
||||||
|
getInfoMultipleGroups(list, function(info){
|
||||||
|
|
||||||
|
if(info.error)
|
||||||
|
return getListError();
|
||||||
|
|
||||||
|
message.remove();
|
||||||
|
|
||||||
//Display the list of the groups of the user
|
//Display the list of the groups of the user
|
||||||
ComunicWeb.pages.groups.pages.main._display_list(pageContainer, list);
|
ComunicWeb.pages.groups.pages.main._display_list(pageContainer, info);
|
||||||
|
|
||||||
|
}, true);
|
||||||
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -66,8 +86,24 @@ ComunicWeb.pages.groups.pages.main = {
|
|||||||
*/
|
*/
|
||||||
_display_list: function(target, list){
|
_display_list: function(target, list){
|
||||||
|
|
||||||
//Process the list of groups
|
for (const i in list) {
|
||||||
list.forEach(function(group){
|
if (list.hasOwnProperty(i)) {
|
||||||
|
const group = list[i];
|
||||||
|
|
||||||
|
ComunicWeb.pages.groups.pages.main._display_group(group, target);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display single group entry
|
||||||
|
*
|
||||||
|
* @param {Object} group Information about the group
|
||||||
|
* @param {HTMLElement} target The target to display
|
||||||
|
* information about the group
|
||||||
|
*/
|
||||||
|
_display_group: function(group, target){
|
||||||
|
|
||||||
//Create group item
|
//Create group item
|
||||||
var groupItem = createElem2({
|
var groupItem = createElem2({
|
||||||
@ -127,8 +163,6 @@ ComunicWeb.pages.groups.pages.main = {
|
|||||||
|
|
||||||
//Display membership status
|
//Display membership status
|
||||||
ComunicWeb.pages.groups.sections.membershipBlock.display(group, groupItem);
|
ComunicWeb.pages.groups.sections.membershipBlock.display(group, groupItem);
|
||||||
});
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user