mirror of
https://github.com/pierre42100/ComunicWeb
synced 2024-11-25 21:39:21 +00:00
Display when the user is a moderator, a administrator or a member of a group.
This commit is contained in:
parent
9866298f19
commit
a100d4a403
@ -1247,6 +1247,12 @@ var ComunicWeb = {
|
||||
//TODO : implement
|
||||
},
|
||||
|
||||
/**
|
||||
* Membership block
|
||||
*/
|
||||
membershipBlock: {
|
||||
//TODO : implement
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
|
@ -90,5 +90,12 @@ ComunicWeb.pages.groups.pages.forbidden = {
|
||||
innerHTML: result.name,
|
||||
class: "group-name"
|
||||
});
|
||||
|
||||
//Add a notice
|
||||
add_p(boxBody, "A registration is required to access this group contents.");
|
||||
|
||||
//Append membership block (if the user is signed in)
|
||||
if(signed_in())
|
||||
ComunicWeb.pages.groups.sections.membershipBlock.display(result);
|
||||
},
|
||||
}
|
@ -72,6 +72,10 @@ ComunicWeb.pages.groups.sections.header = {
|
||||
innerHTML: '<i class="fa fa-group"></i> '+ info.number_members+' members'
|
||||
});
|
||||
|
||||
//Display membership level
|
||||
if(signed_in())
|
||||
ComunicWeb.pages.groups.sections.membershipBlock.display(info, secondColumn);
|
||||
|
||||
//If the user is an admin, add a link to configure the page
|
||||
if(signed_in() && info.membership == "administrator"){
|
||||
|
||||
|
47
assets/js/pages/groups/sections/membershipBlock.js
Normal file
47
assets/js/pages/groups/sections/membershipBlock.js
Normal file
@ -0,0 +1,47 @@
|
||||
/**
|
||||
* Membership information block
|
||||
*
|
||||
* @author Pierre HUBERT
|
||||
*/
|
||||
|
||||
ComunicWeb.pages.groups.sections.membershipBlock = {
|
||||
|
||||
/**
|
||||
* Display membership block
|
||||
*
|
||||
* @param {Object} info Information about the membership
|
||||
* @param {HTMLElement} target The target where the block will be applied
|
||||
*/
|
||||
display: function(info, target){
|
||||
|
||||
//Membership container
|
||||
var container = createElem2({
|
||||
appendTo: target,
|
||||
type: "div"
|
||||
});
|
||||
|
||||
//Check if the user is an administrator / moderator / member
|
||||
if(info.membership == "administrator")
|
||||
return createElem2({
|
||||
appendTo: container,
|
||||
type: "span",
|
||||
innerHTML: "<i class='fa fa-check'></i> Administrator"
|
||||
});
|
||||
|
||||
if(info.membership == "moderator")
|
||||
return createElem2({
|
||||
appendTo: container,
|
||||
type: "span",
|
||||
innerHTML: "<i class='fa fa-check'></i> Moderator"
|
||||
});
|
||||
|
||||
if(info.membership == "member")
|
||||
return createElem2({
|
||||
appendTo: container,
|
||||
type: "span",
|
||||
innerHTML: "<i class='fa fa-check'></i> Member"
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
};
|
@ -432,6 +432,7 @@ class Dev {
|
||||
|
||||
//Groups sections
|
||||
"js/pages/groups/sections/header.js",
|
||||
"js/pages/groups/sections/membershipBlock.js",
|
||||
|
||||
|
||||
//User settings page
|
||||
|
Loading…
Reference in New Issue
Block a user