mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
[ticket/6466] Improve behavior of select and properly save role
PHPBB3-6466
This commit is contained in:
parent
467c794b97
commit
fc00447520
2 changed files with 18 additions and 4 deletions
|
@ -46,10 +46,11 @@
|
||||||
<div class="dropdown hidden">
|
<div class="dropdown hidden">
|
||||||
<ul class="dropdown-contents" id="role{p_mask.S_ROW_COUNT}{p_mask.f_mask.S_ROW_COUNT}" >
|
<ul class="dropdown-contents" id="role{p_mask.S_ROW_COUNT}{p_mask.f_mask.S_ROW_COUNT}" >
|
||||||
{% for role in loops.role_options %}
|
{% for role in loops.role_options %}
|
||||||
<li data-id="{{ role.ID }}" data-target-id="advanced{p_mask.S_ROW_COUNT}{p_mask.f_mask.S_ROW_COUNT}" data-title="{{ role.TITLE }}">{{ role.ROLE_NAME }}</li>
|
<li data-id="{{ role.ID }}" data-target-id="advanced{p_mask.S_ROW_COUNT}{p_mask.f_mask.S_ROW_COUNT}" data-title="{{ role.TITLE }}"{% if role.SELECTED == true %} data-selected="{{ role.SELECTED }}"{% endif %}>{{ role.ROLE_NAME }}</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
<input type="hidden" name="role[{p_mask.f_mask.UG_ID}][{p_mask.f_mask.FORUM_ID}]" />
|
||||||
</div>
|
</div>
|
||||||
</dd>
|
</dd>
|
||||||
<!-- ELSE -->
|
<!-- ELSE -->
|
||||||
|
|
|
@ -198,7 +198,16 @@ $(function() {
|
||||||
|
|
||||||
// Prepare highlighting of select options and settings update
|
// Prepare highlighting of select options and settings update
|
||||||
$options.each(function () {
|
$options.each(function () {
|
||||||
$(this).on('mouseover', function (e) {
|
var $this = $(this);
|
||||||
|
var $roles_options = $this.closest('.roles-options');
|
||||||
|
|
||||||
|
// Correctly show selected option
|
||||||
|
if (typeof $this.attr('data-selected') !== 'undefined') {
|
||||||
|
$this.closest('.roles-options').children('span').text($this.text());
|
||||||
|
$('')
|
||||||
|
}
|
||||||
|
|
||||||
|
$this.on('mouseover', function (e) {
|
||||||
var $this = $(this);
|
var $this = $(this);
|
||||||
$options.removeClass('roles-highlight');
|
$options.removeClass('roles-highlight');
|
||||||
$this.addClass('roles-highlight');
|
$this.addClass('roles-highlight');
|
||||||
|
@ -210,7 +219,11 @@ $(function() {
|
||||||
init_colours($this.attr('data-target-id').replace('advanced', ''));
|
init_colours($this.attr('data-target-id').replace('advanced', ''));
|
||||||
|
|
||||||
// Set selected setting
|
// Set selected setting
|
||||||
$this.closest('.roles-options').children('span').text($this.text());
|
$roles_options.children('span').text($this.text());
|
||||||
|
$roles_options.children('input[type=hidden]').val($this.attr('data-id'));
|
||||||
|
|
||||||
|
// Trigger hiding of selection options
|
||||||
|
$('body').trigger('click');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Reference in a new issue