mirror of
https://github.com/pierre42100/ComunicWeb
synced 2024-11-26 13:59:23 +00:00
Upgraded openUserPage function
This commit is contained in:
parent
665cbb8374
commit
51c248e463
@ -38,6 +38,19 @@ function openPage(pageURI, additionnalData){
|
|||||||
* @return {Boolean} True for a success
|
* @return {Boolean} True for a success
|
||||||
*/
|
*/
|
||||||
function openUserPage(user){
|
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);
|
return openPage("user/" + user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,7 +159,7 @@ ComunicWeb.components.friends.bar = {
|
|||||||
|
|
||||||
//Make the link lives
|
//Make the link lives
|
||||||
friendLink.onclick = function(){
|
friendLink.onclick = function(){
|
||||||
openUserPage(userIDorPath(userInfos));
|
openUserPage(userInfos);
|
||||||
|
|
||||||
//For the responsive mode
|
//For the responsive mode
|
||||||
ComunicWeb.components.friends.bar.toggleShowHide();
|
ComunicWeb.components.friends.bar.toggleShowHide();
|
||||||
|
@ -213,7 +213,7 @@ ComunicWeb.components.friends.listModal = {
|
|||||||
userLink.onclick = function(){
|
userLink.onclick = function(){
|
||||||
|
|
||||||
//Open user page
|
//Open user page
|
||||||
openUserPage(userIDorPath(users["user-" + id]));
|
openUserPage(users["user-" + id]);
|
||||||
|
|
||||||
//Close all modals
|
//Close all modals
|
||||||
$(".modal").modal("hide");
|
$(".modal").modal("hide");
|
||||||
|
@ -55,7 +55,7 @@ ComunicWeb.components.friends.ui = {
|
|||||||
userLink.onclick = function(){
|
userLink.onclick = function(){
|
||||||
|
|
||||||
//Open user page
|
//Open user page
|
||||||
openUserPage(userIDorPath(user));
|
openUserPage(user);
|
||||||
|
|
||||||
//Close all modals
|
//Close all modals
|
||||||
$(".modal").modal("hide");
|
$(".modal").modal("hide");
|
||||||
|
@ -186,7 +186,7 @@ ComunicWeb.components.menuBar.authenticated = {
|
|||||||
userimage.src = userInfos.accountImage;
|
userimage.src = userInfos.accountImage;
|
||||||
|
|
||||||
userlinkelement.onclick = function(){
|
userlinkelement.onclick = function(){
|
||||||
openUserPage(userIDorPath(userInfos));
|
openUserPage(userInfos);
|
||||||
}
|
}
|
||||||
|
|
||||||
}), true);
|
}), true);
|
||||||
|
@ -77,7 +77,7 @@ ComunicWeb.components.notifications.ui = {
|
|||||||
if(data.on_elem_type == "friend_request"){
|
if(data.on_elem_type == "friend_request"){
|
||||||
|
|
||||||
//Open user page
|
//Open user page
|
||||||
openUserPage(data.from_user_id);
|
openUserPageFromID(data.from_user_id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ ComunicWeb.components.posts.ui = {
|
|||||||
userName.innerHTML = result.firstName + " " + result.lastName;
|
userName.innerHTML = result.firstName + " " + result.lastName;
|
||||||
|
|
||||||
userName.onclick = function(){
|
userName.onclick = function(){
|
||||||
openUserPage(userIDorPath(result));
|
openUserPage(result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -153,7 +153,7 @@ ComunicWeb.components.searchForm = {
|
|||||||
//Make user link element live
|
//Make user link element live
|
||||||
userLinkElement.onclick = function() {
|
userLinkElement.onclick = function() {
|
||||||
ComunicWeb.components.searchForm.close();
|
ComunicWeb.components.searchForm.close();
|
||||||
openUserPage(userIDorPath(userInfos));
|
openUserPage(userInfos);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@ ComunicWeb.components.textParser = {
|
|||||||
node.addEventListener("click", function(ev){
|
node.addEventListener("click", function(ev){
|
||||||
|
|
||||||
//Open user page
|
//Open user page
|
||||||
openUserPage(userID);
|
openPage(userID);
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -82,7 +82,7 @@ ComunicWeb.pages.userPage.friendshipStatus = {
|
|||||||
|
|
||||||
else {
|
else {
|
||||||
//Reopen user page
|
//Reopen user page
|
||||||
openUserPage(userID);
|
openUserPageFromID(userID);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user