aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/assets/javascript
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2014-05-11 10:48:10 +0200
committerJoas Schilling <nickvergessen@gmx.de>2014-05-11 10:48:10 +0200
commit6cd7abe2557336a88db0220603c83743f1291642 (patch)
tree7c9e18e9ab43653e166739b9392c2f8234ade889 /phpBB/assets/javascript
parent9aee2ed03995aca1d0348681bcb68d0042801d3a (diff)
parente233f0af3615070a003a49bf055ae9fa582cc899 (diff)
downloadforums-6cd7abe2557336a88db0220603c83743f1291642.tar
forums-6cd7abe2557336a88db0220603c83743f1291642.tar.gz
forums-6cd7abe2557336a88db0220603c83743f1291642.tar.bz2
forums-6cd7abe2557336a88db0220603c83743f1291642.tar.xz
forums-6cd7abe2557336a88db0220603c83743f1291642.zip
Merge pull request #2420 from prototech/ticket/9388
[ticket/9388] Only display the settings for the selected method in the auth and search ACP pages. * prototech/ticket/9388: [ticket/9388] Use "togglable" instead of "toggable" [ticket/9388] Do not nest the <fieldset> tags in the OAuth settings. [ticket/9388] Reopen <fieldset> after auth templates. [ticket/9388] Fix unit tests. [ticket/9388] Use the new toggle function for the avatar type <select>. [ticket/9388] Display only the settings for the selected search backend. [ticket/9388] Display only the settings for the auth method that's selected. [ticket/9388] Add support for making <select> options able to toggle settings.
Diffstat (limited to 'phpBB/assets/javascript')
-rw-r--r--phpBB/assets/javascript/core.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/phpBB/assets/javascript/core.js b/phpBB/assets/javascript/core.js
index ae8583ddbf..cd633ed2ae 100644
--- a/phpBB/assets/javascript/core.js
+++ b/phpBB/assets/javascript/core.js
@@ -1476,6 +1476,21 @@ phpbb.toggleDisplay = function(id, action, type) {
}
/**
+* Toggle additional settings based on the selected
+* option of select element.
+*
+* @param jQuery el jQuery select element object.
+* @return undefined
+*/
+phpbb.toggleSelectSettings = function(el) {
+ el.children().each(function() {
+ var option = $(this),
+ setting = $(option.data('toggle-setting'));
+ setting.toggle(option.is(':selected'));
+ });
+};
+
+/**
* Get function from name.
* Based on http://stackoverflow.com/a/359910
*
@@ -1516,6 +1531,16 @@ $(document).ready(function() {
// Update browser history URL to point to specific post in viewtopic.php
// when using view=unread#unread link.
phpbb.history.replaceUrl($('#unread[data-url]').data('url'));
+
+ // Hide settings that are not selected via select element.
+ $('select[data-togglable-settings]').each(function() {
+ var select = $(this);
+
+ select.change(function() {
+ phpbb.toggleSelectSettings(select);
+ });
+ phpbb.toggleSelectSettings(select);
+ });
});
})(jQuery); // Avoid conflicts with other libraries