Display user name on its page

This commit is contained in:
Pierre 2017-12-23 14:52:01 +01:00
parent e89ae955c2
commit 28ce08883a
5 changed files with 101 additions and 2 deletions

View File

@ -710,6 +710,13 @@ var ComunicWeb = {
}, },
/**
* Display user profile informations
*/
profileInfos: {
//TODO : implement
}
}, },
/** /**

View File

@ -71,6 +71,9 @@ ComunicWeb.pages.userPage.accessForbidden = {
*/ */
showBasicInfos: function(userInfos, target){ showBasicInfos: function(userInfos, target){
//Update page title
document.title = userInfos.firstName + " " + userInfos.lastName;
//Create box root //Create box root
var boxRoot = createElem2({ var boxRoot = createElem2({
appendTo: target, appendTo: target,

View File

@ -119,8 +119,33 @@ ComunicWeb.pages.userPage.main = {
* @param {HTMLElement} target Target of the user page * @param {HTMLElement} target Target of the user page
*/ */
displayUserPage: function(infos, params, target){ displayUserPage: function(infos, params, target){
console.log("Display user page based on the informations we got");
console.log(infos); //Update page title
document.title = infos.firstName + " " + infos.lastName;
//Create the section class content
var sectionContent = createElem2({
appendTo: target,
type: "section",
class: "content"
});
//Content row
var row = createElem2({
appendTo: sectionContent,
type: "div",
class: "row"
});
//Create left column
var leftColumn = createElem2({
appendTo: row,
type: "div",
class: "col-md-3"
});
//Display profile informations
ComunicWeb.pages.userPage.profileInfos.display(infos, leftColumn);
} }
} }

View File

@ -0,0 +1,63 @@
/**
* 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
});
}
};

View File

@ -176,6 +176,7 @@ $config['JSfiles'] = array(
"%PATH_ASSETS%js/pages/userPage/main.js", "%PATH_ASSETS%js/pages/userPage/main.js",
"%PATH_ASSETS%js/pages/userPage/accessForbidden.js", "%PATH_ASSETS%js/pages/userPage/accessForbidden.js",
"%PATH_ASSETS%js/pages/userPage/friendshipStatus.js", "%PATH_ASSETS%js/pages/userPage/friendshipStatus.js",
"%PATH_ASSETS%js/pages/userPage/profileInfos.js",
//Login page //Login page
"%PATH_ASSETS%js/pages/login.js", "%PATH_ASSETS%js/pages/login.js",