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
|
|
|
|
2017-12-23 17:19:06 +00:00
|
|
|
//Add list of informations about user
|
|
|
|
var listInfos = createElem2({
|
|
|
|
appendTo: boxBody,
|
|
|
|
type: "url",
|
|
|
|
class: "list-group list-group-unbordered"
|
|
|
|
});
|
|
|
|
|
|
|
|
//Add number of friends
|
|
|
|
var friendsLi = createElem2({
|
|
|
|
appendTo: listInfos,
|
|
|
|
type: "li",
|
|
|
|
class: "list-group-item"
|
|
|
|
});
|
|
|
|
createElem2({
|
|
|
|
appendTo: friendsLi,
|
|
|
|
type: "b",
|
|
|
|
innerHTML: "Friends"
|
|
|
|
});
|
|
|
|
createElem2({
|
|
|
|
appendTo: friendsLi,
|
|
|
|
type: "a",
|
|
|
|
class: "pull-right",
|
|
|
|
innerHTML: infos.number_friends
|
|
|
|
})
|
|
|
|
|
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
|
|
|
}
|
|
|
|
};
|