ComunicWeb/assets/js/pages/userPage/profileInfos.js

77 lines
1.7 KiB
JavaScript
Raw Normal View History

2017-12-23 13:52:01 +00:00
/**
* Profile informations displaying handler
*
* Handlers the rendering of informations such as
* the name of the user, or account informations
*
* @author Pierre HUBERT
*/
ComunicWeb.pages.userPage.profileInfos = {
/**
* Display profile informations
*
* @param {Object} infos Informations about the user
* @param {HTMLElement} target The target of the profile informations
*/
display: function(infos, target){
//Create the main box
this.createMainBox(infos, target);
},
/**
* Display the main informations about the user
*
* @param {Object} infos Informations about the user
* @param {HTMLElement} target The target of the box
*/
createMainBox: function(infos, target){
//Create box contener
var boxContener = createElem2({
appendTo: target,
type: "div",
class: "box box-primary"
});
//Setup box body
var boxBody = createElem2({
appendTo: boxContener,
type: "div",
class: "box-body box-profile"
});
//Add user image
var userImage = createElem2({
appendTo: boxBody,
type: "img",
class: "profile-user-img img-responsive img-circle",
src: infos.accountImage
});
//Add user name
var userName = createElem2({
appendTo: boxBody,
type: "h3",
class: "profile-username text-center",
innerHTML: infos.firstName + " " + infos.lastName
});
2017-12-23 16:46:55 +00:00
//Add user status informations (if required)
if(signed_in()){
if(userID() != infos.userID){
var userStatus = createElem2({
appendTo: boxBody,
type: "div",
innerHTML: "Loading...",
});
userStatus.style.textAlign = "center";
ComunicWeb.pages.userPage.friendshipStatus.display(infos.userID, userStatus);
}
}
2017-12-23 13:52:01 +00:00
}
};