Fixed issue in menu item handler
authorMarcel Werk <burntime@woltlab.com>
Tue, 3 May 2016 09:29:44 +0000 (11:29 +0200)
committerMarcel Werk <burntime@woltlab.com>
Tue, 3 May 2016 09:35:32 +0000 (11:35 +0200)
wcfsetup/install/files/js/WoltLab/WCF/Acp/Ui/Menu/Item/Handler.js

index d83826fbcb2b1bc5d56adf133a7b61f6643dc764..2029a8ef515c452a37d967f9b42fd49173043f16 100644 (file)
@@ -34,14 +34,6 @@ define(['Dictionary', 'WoltLab/Wcf/Ui/Page/Search/Handler'], function(Dictionary
                        _containerExternalLink = elById('externalURLContainer');
                        _containerPageObjectId = elById('pageObjectIDContainer');
                        
-                       elBySelAll('input[name="isInternalLink"]', null, (function(input) {
-                               input.addEventListener('change', this._toggleIsInternalLink.bind(this, input.value));
-                               
-                               if (input.checked) {
-                                       this._toggleIsInternalLink(input.value);
-                               }
-                       }).bind(this));
-                       
                        if (_handlers.size) {
                                _pageId = elById('pageID');
                                _pageId.addEventListener('change', this._togglePageId.bind(this));
@@ -61,6 +53,14 @@ define(['Dictionary', 'WoltLab/Wcf/Ui/Page/Search/Handler'], function(Dictionary
                                        elShow(_containerPageObjectId);
                                }
                        }
+                       
+                       elBySelAll('input[name="isInternalLink"]', null, (function(input) {
+                               input.addEventListener('change', this._toggleIsInternalLink.bind(this, input.value));
+                               
+                               if (input.checked) {
+                                       this._toggleIsInternalLink(input.value);
+                               }
+                       }).bind(this));
                },
                
                /**
@@ -70,8 +70,16 @@ define(['Dictionary', 'WoltLab/Wcf/Ui/Page/Search/Handler'], function(Dictionary
                 * @protected
                 */
                _toggleIsInternalLink: function(value) {
-                       window[(~~value ? 'elShow' : 'elHide')](_containerInternalLink);
-                       window[(~~value ? 'elHide' : 'elShow')](_containerExternalLink);
+                       if (~~value) {
+                               elShow(_containerInternalLink);
+                               elHide(_containerExternalLink);
+                               this._togglePageId();
+                       }
+                       else {
+                               elHide(_containerInternalLink);
+                               elHide(_containerPageObjectId);
+                               elShow(_containerExternalLink);
+                       }
                },
                
                /**