mirror of
https://github.com/pierre42100/ComunicWeb
synced 2024-11-22 12:09:21 +00:00
Display basic information about a group when access to it is forbidden.
This commit is contained in:
parent
dfce597139
commit
7db41a9183
22
assets/css/pages/groups/pages/forbidden.css
Normal file
22
assets/css/pages/groups/pages/forbidden.css
Normal file
@ -0,0 +1,22 @@
|
||||
/**
|
||||
* Access forbidden to page groups stylesheet
|
||||
*
|
||||
* @author Pierre HUBERT
|
||||
*/
|
||||
|
||||
.group-forbidden-page-container {
|
||||
max-width: 300px;
|
||||
margin: auto;
|
||||
margin-top: 15px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.group-forbidden-page-container .group-logo {
|
||||
width: 130px;
|
||||
margin: auto;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.group-forbidden-page-container .group-name {
|
||||
margin-bottom: 15px;
|
||||
}
|
@ -1226,6 +1226,13 @@ var ComunicWeb = {
|
||||
//TODO : implement
|
||||
},
|
||||
|
||||
/**
|
||||
* Access to group forbidden page
|
||||
*/
|
||||
forbidden: {
|
||||
//TODO : implemement
|
||||
},
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
|
94
assets/js/pages/groups/pages/forbidden.js
Normal file
94
assets/js/pages/groups/pages/forbidden.js
Normal file
@ -0,0 +1,94 @@
|
||||
/**
|
||||
* Access to group forbiden page script
|
||||
*
|
||||
* @author Pierre HUBERT
|
||||
*/
|
||||
|
||||
ComunicWeb.pages.groups.pages.forbidden = {
|
||||
|
||||
/**
|
||||
* Open access forbidden page
|
||||
*
|
||||
* @param {Number} id The ID of the target group
|
||||
* @param {HTMLElement} target The target of the page
|
||||
*/
|
||||
open: function(id, target){
|
||||
|
||||
//Create page container
|
||||
var pageContainer = createElem2({
|
||||
appendTo: target,
|
||||
type: "div",
|
||||
class: "group-forbidden-page-container"
|
||||
});
|
||||
|
||||
//Loading message target
|
||||
var loadingMessage = ComunicWeb.common.messages.createCalloutElem(
|
||||
"Loading",
|
||||
"Please wait while we load a few information...",
|
||||
"info");
|
||||
pageContainer.appendChild(loadingMessage);
|
||||
|
||||
//Get information about the page
|
||||
ComunicWeb.components.groups.interface.getInfo(id, function(result){
|
||||
|
||||
//Remove loading message
|
||||
loadingMessage.remove();
|
||||
|
||||
//Check for errors
|
||||
if(result.error){
|
||||
pageContainer.appendChild(
|
||||
ComunicWeb.common.messages.createCalloutElem(
|
||||
"Error",
|
||||
"An error occured while retrieve group information!",
|
||||
"danger"
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
//Display forbidden page
|
||||
ComunicWeb.pages.groups.pages.forbidden.display(id, result, pageContainer);
|
||||
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Display forbidden page
|
||||
*
|
||||
* @param {Number} id The ID of the group
|
||||
* @param {Object} result Information about the group
|
||||
* @param {HTMLElement} target The target for the page
|
||||
*/
|
||||
display: function(id, result, target){
|
||||
|
||||
//Create a box to contain information about registration
|
||||
var box = createElem2({
|
||||
appendTo: target,
|
||||
type: "div",
|
||||
class: "box box-primary"
|
||||
});
|
||||
|
||||
//Box body
|
||||
var boxBody = createElem2({
|
||||
appendTo: box,
|
||||
class: "box-body"
|
||||
});
|
||||
|
||||
//Display basical information about the group
|
||||
//Group logo
|
||||
createElem2({
|
||||
appendTo: boxBody,
|
||||
type: "img",
|
||||
src: result.icon_url,
|
||||
class: "group-logo"
|
||||
});
|
||||
|
||||
//Add group title
|
||||
createElem2({
|
||||
appendTo: boxBody,
|
||||
type: "h2",
|
||||
innerHTML: result.name,
|
||||
class: "group-name"
|
||||
});
|
||||
},
|
||||
}
|
@ -22,7 +22,7 @@ ComunicWeb.pages.groups.pages.group = {
|
||||
|
||||
//Check the code of the error
|
||||
if(result.error.code == 401){
|
||||
need_auth;//TODO : implement
|
||||
ComunicWeb.pages.groups.pages.forbidden.open(id, target);
|
||||
}
|
||||
|
||||
else
|
||||
|
@ -222,6 +222,7 @@ class Dev {
|
||||
"css/pages/groups/pages/create.css",
|
||||
"css/pages/groups/pages/group.css",
|
||||
"css/pages/groups/pages/settings.css",
|
||||
"css/pages/groups/pages/forbidden.css",
|
||||
|
||||
//Groups sections
|
||||
"css/pages/groups/sections/header.css",
|
||||
@ -427,6 +428,7 @@ class Dev {
|
||||
"js/pages/groups/pages/create.js",
|
||||
"js/pages/groups/pages/group.js",
|
||||
"js/pages/groups/pages/settings.js",
|
||||
"js/pages/groups/pages/forbidden.js",
|
||||
|
||||
//Groups sections
|
||||
"js/pages/groups/sections/header.js",
|
||||
|
Loading…
Reference in New Issue
Block a user