mirror of
https://github.com/pierre42100/ComunicWeb
synced 2024-11-26 13:59:23 +00:00
Created friendList component
This commit is contained in:
parent
09e34a8969
commit
34ce3f9c13
@ -441,7 +441,12 @@ var ComunicWeb = {
|
|||||||
//TODO : implement
|
//TODO : implement
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Friends list
|
||||||
|
*/
|
||||||
|
friendsList: {
|
||||||
|
//TODO : implement
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -107,6 +107,11 @@ ComunicWeb.common.page = {
|
|||||||
firstPartURI = firstPartURI.split("#")[0];
|
firstPartURI = firstPartURI.split("#")[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Check if there are $_GET parametres included with the URL
|
||||||
|
if(firstPartURI.includes("?") != -1){
|
||||||
|
firstPartURI = firstPartURI.split("?")[0];
|
||||||
|
}
|
||||||
|
|
||||||
//Check if pageURI is empty
|
//Check if pageURI is empty
|
||||||
if(firstPartURI == ""){
|
if(firstPartURI == ""){
|
||||||
firstPartURI = "home";
|
firstPartURI = "home";
|
||||||
@ -178,6 +183,12 @@ ComunicWeb.common.page = {
|
|||||||
|
|
||||||
//We load the menubar
|
//We load the menubar
|
||||||
ComunicWeb.components.menuBar.common.display();
|
ComunicWeb.components.menuBar.common.display();
|
||||||
|
|
||||||
|
//We load specific components for logged in users
|
||||||
|
if(ComunicWeb.user.userLogin.getUserLoginState()){
|
||||||
|
//We load frieds list (if user is logged in)
|
||||||
|
ComunicWeb.components.friendsList.display();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Check if some additionnal data was specified
|
//Check if some additionnal data was specified
|
||||||
|
59
assets/js/components/friendsList/friendsList.js
Normal file
59
assets/js/components/friendsList/friendsList.js
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
/**
|
||||||
|
* Friends list
|
||||||
|
*
|
||||||
|
* @author Pierre HUBERT
|
||||||
|
*/
|
||||||
|
|
||||||
|
ComunicWeb.components.friendsList = {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display friends list
|
||||||
|
*
|
||||||
|
* @return {Boolean} True for a success
|
||||||
|
*/
|
||||||
|
display: function(){
|
||||||
|
//Log action
|
||||||
|
ComunicWeb.debug.logMessage("Initialize friends list.");
|
||||||
|
|
||||||
|
//Check if friends list already exists or not
|
||||||
|
var friendsListContainer = byId("friendsList");
|
||||||
|
|
||||||
|
//We check if the friend list already exists or not
|
||||||
|
if(friendsListContainer){
|
||||||
|
ComunicWeb.debug.logMessage("Notice: friend list already present on the page. Nothing to be done.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Create and apply friends list element
|
||||||
|
var friendsListContainer = createElem("div");
|
||||||
|
|
||||||
|
//Check if "pageTarget" already exists or not
|
||||||
|
var pageTarget = byId("pageTarget");
|
||||||
|
if(pageTarget){
|
||||||
|
//Insert friends list just before pageTarget
|
||||||
|
byId("wrapper").insertBefore(friendsListContainer, pageTarget);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
byId("wrapper").appendChild(friendsListContainer); //Just happend the menubar
|
||||||
|
}
|
||||||
|
|
||||||
|
//Initializate friends list
|
||||||
|
this.init(friendsListContainer);
|
||||||
|
|
||||||
|
//Success
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializate a friend list
|
||||||
|
*
|
||||||
|
* @param {HTMLElement} friendsListContainer The container of the friend list
|
||||||
|
* @return {Boolean} True for a success
|
||||||
|
*/
|
||||||
|
init: function(friendsListContainer){
|
||||||
|
|
||||||
|
|
||||||
|
//Success
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
@ -68,6 +68,7 @@ $config['JSfiles'] = array(
|
|||||||
"%PATH_ASSETS%js/components/menuBar/common.js",
|
"%PATH_ASSETS%js/components/menuBar/common.js",
|
||||||
"%PATH_ASSETS%js/components/menuBar/notAuthenticated.js",
|
"%PATH_ASSETS%js/components/menuBar/notAuthenticated.js",
|
||||||
"%PATH_ASSETS%js/components/menuBar/authenticated.js",
|
"%PATH_ASSETS%js/components/menuBar/authenticated.js",
|
||||||
|
"%PATH_ASSETS%js/components/friendsList/friendsList.js",
|
||||||
|
|
||||||
//User scripts
|
//User scripts
|
||||||
"%PATH_ASSETS%js/user/loginTokens.js",
|
"%PATH_ASSETS%js/user/loginTokens.js",
|
||||||
|
Loading…
Reference in New Issue
Block a user