From 754a724e43db840223b9e6ca94afbc3b73eb51ba Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Wed, 4 Jan 2017 13:24:57 +0100 Subject: [PATCH] Fixed profile editing behavior --- com.woltlab.wcf/templates/pageHeaderUser.tpl | 2 +- com.woltlab.wcf/templates/user.tpl | 10 +++++++++- wcfsetup/install/files/js/WCF.User.js | 7 +++++++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/com.woltlab.wcf/templates/pageHeaderUser.tpl b/com.woltlab.wcf/templates/pageHeaderUser.tpl index de4f28b748..c42909b551 100644 --- a/com.woltlab.wcf/templates/pageHeaderUser.tpl +++ b/com.woltlab.wcf/templates/pageHeaderUser.tpl @@ -41,7 +41,7 @@ diff --git a/com.woltlab.wcf/templates/user.tpl b/com.woltlab.wcf/templates/user.tpl index 887efa3c75..06896a6af1 100644 --- a/com.woltlab.wcf/templates/user.tpl +++ b/com.woltlab.wcf/templates/user.tpl @@ -63,7 +63,15 @@ 'wcf.user.editProfile': '{lang}wcf.user.editProfile{/lang}' }); - new WCF.User.Profile.Editor({@$user->userID}, {if $editOnInit}true{else}false{/if}); + var userProfileEditor = new WCF.User.Profile.Editor({@$user->userID}, {if $editOnInit}true{else}false{/if}); + var editLink = elBySel('.interactiveDropdownItemsUserMenu .jsUserPanelEditProfile'); + if (editLink) { + editLink.addEventListener(WCF_CLICK_EVENT, function (event) { + userProfileEditor._beginEdit(event); + + WCF.CloseOverlayHandler.forceExecution(); + }); + } {/if} {if $followingCount > 7} diff --git a/wcfsetup/install/files/js/WCF.User.js b/wcfsetup/install/files/js/WCF.User.js index 05e35bd61d..0bf2e8e742 100644 --- a/wcfsetup/install/files/js/WCF.User.js +++ b/wcfsetup/install/files/js/WCF.User.js @@ -897,6 +897,8 @@ WCF.User.Profile.Editor = Class.extend({ */ _actionName: '', + _active: false, + /** * list of interface buttons * @var object @@ -935,6 +937,7 @@ WCF.User.Profile.Editor = Class.extend({ */ init: function(userID, editOnInit) { this._actionName = ''; + this._active = false; this._cachedTemplate = ''; this._tab = $('#about'); this._userID = userID; @@ -968,6 +971,9 @@ WCF.User.Profile.Editor = Class.extend({ _beginEdit: function(event) { if (event) event.preventDefault(); + if (this._active) return; + this._active = true; + this._actionName = 'beginEdit'; this._buttons.beginEdit.parent().addClass('active'); $('#profileContent').wcfTabs('select', 'about'); @@ -1045,6 +1051,7 @@ WCF.User.Profile.Editor = Class.extend({ */ _restore: function() { this._actionName = 'restore'; + this._active = false; this._buttons.beginEdit.parent().removeClass('active'); this._destroyEditor(); -- 2.20.1