From b24c2ea5be700b09053c9916f15f807c195d151b Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Thu, 1 Dec 2016 11:34:00 +0100 Subject: [PATCH] [ticket/14736] Reset role dropdown when modifying permissions PHPBB3-14736 --- phpBB/adm/style/tooltip.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/phpBB/adm/style/tooltip.js b/phpBB/adm/style/tooltip.js index 65773ae14f..8781e2b509 100644 --- a/phpBB/adm/style/tooltip.js +++ b/phpBB/adm/style/tooltip.js @@ -211,6 +211,23 @@ $(function() { // Prepare dropdown phpbb.prepareRolesDropdown(); + + // Reset role drop-down on modifying permissions in advanced tab + $('div.permissions-switch > a').on('click', function () { + $.each($('input[type=radio][name^="setting["]'), function () { + var $this = $(this); + $this.on('click', function () { + var $rolesOptions = $this.closest('fieldset.permissions').find('.roles-options'), + rolesSelect = $rolesOptions.find('select > option')[0]; + + // Set selected setting + $rolesOptions.children('span') + .text(rolesSelect.text); + $rolesOptions.children('input[type=hidden]') + .val(rolesSelect.value); + }); + }); + }); }); })(jQuery); // Avoid conflicts with other libraries