Fixed profile editing behavior
authorAlexander Ebert <ebert@woltlab.com>
Wed, 4 Jan 2017 12:24:57 +0000 (13:24 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Wed, 4 Jan 2017 15:37:58 +0000 (16:37 +0100)
com.woltlab.wcf/templates/pageHeaderUser.tpl
com.woltlab.wcf/templates/user.tpl
wcfsetup/install/files/js/WCF.User.js

index de4f28b7489a7bf073b141989661506544a9bbad..c42909b5511695e3c3f6a409b188487227fdbdb1 100644 (file)
@@ -41,7 +41,7 @@
                                                                                
                                                                                <ul class="inlineList dotSeparated">
                                                                                        <li><a href="{link controller='User' object=$__wcf->user}{/link}">{lang}wcf.user.myProfile{/lang}</a></li>
-                                                                                       {if $__wcf->getUserProfileHandler()->canEditOwnProfile()}<li><a href="{link controller='User' object=$__wcf->user}editOnInit=true#about{/link}">{lang}wcf.user.editProfile{/lang}</a></li>{/if}
+                                                                                       {if $__wcf->getUserProfileHandler()->canEditOwnProfile()}<li><a href="{link controller='User' object=$__wcf->user}editOnInit=true#about{/link}" class="jsUserPanelEditProfile">{lang}wcf.user.editProfile{/lang}</a></li>{/if}
                                                                                        {if $__wcf->session->getPermission('admin.general.canUseAcp')}<li><a href="{link isACP=true}{/link}">{lang}wcf.global.acp.short{/lang}</a></li>{/if}
                                                                                </ul>
                                                                        </div>
index 887efa3c751f94868d1b3ca7148a864e70014246..06896a6af14e04377fdf266766ade044e65f3895 100644 (file)
                                        '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}
index 05e35bd61dc716c84232af102395e270905b7bed..0bf2e8e742a375bc9e0c65c9c5f7f3be0c76b1ea 100644 (file)
@@ -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();