diff --git a/assets/js/components/searchForm/searchForm.js b/assets/js/components/searchForm/searchForm.js index 56e63c6f..511cd093 100644 --- a/assets/js/components/searchForm/searchForm.js +++ b/assets/js/components/searchForm/searchForm.js @@ -5,6 +5,12 @@ */ ComunicWeb.components.searchForm = { + + /** + * Store the text input area + */ + _textInput: null, + /** * Initializate a search form element * @@ -42,6 +48,9 @@ ComunicWeb.components.searchForm = { ComunicWeb.components.searchForm.ontextchange(textInput, searchResultBox, searchBoxContainer, footerLink); } + //Cache textinput area + this._textInput = textInput; + return true; }, @@ -140,5 +149,19 @@ ComunicWeb.components.searchForm = { //Apply user informations userImage.src = userInfos.accountImage; usernameElem.innerHTML = userInfos.firstName + " " + userInfos.lastName; + + //Make user link element live + userLinkElement.onclick = function() { + ComunicWeb.components.searchForm.close(); + openUserPage(userIDorPath(userInfos)); + } }, + + /** + * Close and clear the search form + */ + close: function(){ + this._textInput.value = ""; + this._textInput.onkeyup(); + } } \ No newline at end of file diff --git a/assets/js/user/userInfos.js b/assets/js/user/userInfos.js index 4b627d34..b9b7ab72 100644 --- a/assets/js/user/userInfos.js +++ b/assets/js/user/userInfos.js @@ -256,7 +256,7 @@ ComunicWeb.user.userInfos = { getIDorPath: function(userInfos){ //Check if a virtual directory is available - if(userInfos.virtualDirectory != null){ + if(userInfos.virtualDirectory != null && userInfos.virtualDirectory != ""){ return userInfos.virtualDirectory; }