Upgraded openUserPage function

This commit is contained in:
Pierre HUBERT 2018-07-14 14:18:21 +02:00
parent 665cbb8374
commit 51c248e463
10 changed files with 22 additions and 9 deletions

View File

@ -38,6 +38,19 @@ function openPage(pageURI, additionnalData){
* @return {Boolean} True for a success
*/
function openUserPage(user){
if(user.virtualDirectory == "")
openUserPageFromID(user.userID);
else
openPage(user.virtualDirectory);
}
/**
* Open a user page quickly from its user ID
*
* @param {String} user The ID of the user or its directory
* @return {Boolean} True for a success
*/
function openUserPageFromID(user){
return openPage("user/" + user);
}

View File

@ -159,7 +159,7 @@ ComunicWeb.components.friends.bar = {
//Make the link lives
friendLink.onclick = function(){
openUserPage(userIDorPath(userInfos));
openUserPage(userInfos);
//For the responsive mode
ComunicWeb.components.friends.bar.toggleShowHide();

View File

@ -213,7 +213,7 @@ ComunicWeb.components.friends.listModal = {
userLink.onclick = function(){
//Open user page
openUserPage(userIDorPath(users["user-" + id]));
openUserPage(users["user-" + id]);
//Close all modals
$(".modal").modal("hide");

View File

@ -55,7 +55,7 @@ ComunicWeb.components.friends.ui = {
userLink.onclick = function(){
//Open user page
openUserPage(userIDorPath(user));
openUserPage(user);
//Close all modals
$(".modal").modal("hide");

View File

@ -186,7 +186,7 @@ ComunicWeb.components.menuBar.authenticated = {
userimage.src = userInfos.accountImage;
userlinkelement.onclick = function(){
openUserPage(userIDorPath(userInfos));
openUserPage(userInfos);
}
}), true);

View File

@ -77,7 +77,7 @@ ComunicWeb.components.notifications.ui = {
if(data.on_elem_type == "friend_request"){
//Open user page
openUserPage(data.from_user_id);
openUserPageFromID(data.from_user_id);
}

View File

@ -71,7 +71,7 @@ ComunicWeb.components.posts.ui = {
userName.innerHTML = result.firstName + " " + result.lastName;
userName.onclick = function(){
openUserPage(userIDorPath(result));
openUserPage(result);
}
}
});

View File

@ -153,7 +153,7 @@ ComunicWeb.components.searchForm = {
//Make user link element live
userLinkElement.onclick = function() {
ComunicWeb.components.searchForm.close();
openUserPage(userIDorPath(userInfos));
openUserPage(userInfos);
}
},

View File

@ -104,7 +104,7 @@ ComunicWeb.components.textParser = {
node.addEventListener("click", function(ev){
//Open user page
openUserPage(userID);
openPage(userID);
});
}

View File

@ -82,7 +82,7 @@ ComunicWeb.pages.userPage.friendshipStatus = {
else {
//Reopen user page
openUserPage(userID);
openUserPageFromID(userID);
}
});