From: Alexander Ebert Date: Mon, 18 Apr 2016 10:35:21 +0000 (+0200) Subject: Added proper active tab save/restore X-Git-Tag: 3.0.0_Beta_1~1857 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=fd0d6a5ba5e4d62ca7a2f777e03bd4da0713e798;p=GitHub%2FWoltLab%2FWCF.git Added proper active tab save/restore --- diff --git a/wcfsetup/install/files/js/WoltLab/WCF/Ui/TabMenu/Simple.js b/wcfsetup/install/files/js/WoltLab/WCF/Ui/TabMenu/Simple.js index 0359e94ef6..d320c0d629 100644 --- a/wcfsetup/install/files/js/WoltLab/WCF/Ui/TabMenu/Simple.js +++ b/wcfsetup/install/files/js/WoltLab/WCF/Ui/TabMenu/Simple.js @@ -17,6 +17,7 @@ define(['Dictionary', 'EventHandler', 'Dom/Traverse', 'Dom/Util'], function(Dict this._container = container; this._containers = new Dictionary(); this._isLegacy = null; + this._store = null; this._tabs = new Dictionary(); } @@ -139,7 +140,7 @@ define(['Dictionary', 'EventHandler', 'Dom/Traverse', 'Dom/Util'], function(Dict } if (!selectTab) { - var preselect = elData(this._container, 'preselect'); + var preselect = elData(this._container, 'preselect') || elData(this._container, 'active'); if (preselect === "true" || !preselect) preselect = true; if (preselect === true) { @@ -161,6 +162,17 @@ define(['Dictionary', 'EventHandler', 'Dom/Traverse', 'Dom/Util'], function(Dict this.select(null, selectTab, true); } + + var store = elData(this._container, 'store'); + if (store) { + var input = elCreate('input'); + input.type = 'hidden'; + input.name = store; + + this._container.appendChild(input); + + this._store = input; + } } return returnValue; @@ -228,6 +240,10 @@ define(['Dictionary', 'EventHandler', 'Dom/Traverse', 'Dom/Util'], function(Dict newContent.classList.remove('hidden'); } + if (this._store) { + this._store.value = name; + } + if (!disableEvent) { EventHandler.fire('com.woltlab.wcf.simpleTabMenu_' + this._container.id, 'select', { active: tab,