aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/adm/style/tooltip.js
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/adm/style/tooltip.js')
-rw-r--r--phpBB/adm/style/tooltip.js28
1 files changed, 24 insertions, 4 deletions
diff --git a/phpBB/adm/style/tooltip.js b/phpBB/adm/style/tooltip.js
index 641d82c80a..68964034f0 100644
--- a/phpBB/adm/style/tooltip.js
+++ b/phpBB/adm/style/tooltip.js
@@ -141,15 +141,20 @@ phpbb.positionTooltip = function ($element) {
*/
phpbb.prepareRolesDropdown = function () {
var $options = $('.roles-options li');
+ var $rolesOptions = $options.closest('.roles-options');
+ var $span = $rolesOptions.children('span');
// Prepare highlighting of select options and settings update
$options.each(function () {
var $this = $(this);
- var $rolesOptions = $this.closest('.roles-options');
// Correctly show selected option
if (typeof $this.attr('data-selected') !== 'undefined') {
- $this.closest('.roles-options').children('span').text($this.text());
+ $rolesOptions.closest('.roles-options')
+ .children('span')
+ .text($this.text())
+ .attr('data-default', $this.text())
+ .attr('data-default-val', $this.attr('data-id'));
}
$this.on('mouseover', function () {
@@ -164,13 +169,28 @@ phpbb.prepareRolesDropdown = function () {
init_colours($this.attr('data-target-id').replace('advanced', ''));
// Set selected setting
- $rolesOptions.children('span').text($this.text());
- $rolesOptions.children('input[type=hidden]').val($this.attr('data-id'));
+ $rolesOptions.children('span')
+ .text($this.text());
+ $rolesOptions.children('input[type=hidden]')
+ .val($this.attr('data-id'));
// Trigger hiding of selection options
$('body').trigger('click');
});
});
+
+ // Save default text of drop down if there is no default set yet
+ if (typeof $span.attr('data-default') === 'undefined') {
+ $span.attr('data-default', $span.text());
+ }
+
+ // Prepare resetting drop down on form reset
+ $options.closest('form').on('reset', function () {
+ $span.text($span.attr('data-default'));
+ $rolesOptions.children('input[type=hidden]')
+ .val($span.attr('data-id'));
+ });
+
};
// Run onload functions for RolesDropdown and tooltips