Fix #16482 - Select All link for table-specific privileges

Signed-off-by: Saksham Gupta <shucon01@gmail.com>
This commit is contained in:
Saksham Gupta 2021-05-08 00:30:10 +05:30 committed by William Desportes
parent fe4e1d4192
commit 3ea7d86684
No known key found for this signature in database
GPG Key ID: 90A0EF1B8251A889
2 changed files with 43 additions and 0 deletions

View File

@ -413,6 +413,25 @@ AJAX.registerOnload('server/privileges.js', function () {
addOrUpdateSubmenu();
}
/**
* Select all privileges
*
* @param {HTMLElement} e
* @return {void}
*/
var tableSelectAll = function (e) {
const method = e.target.getAttribute('data-select-target');
var options = $(method).first().children();
options.each(function (_, obj) {
obj.selected = true;
});
};
$('#select_priv_all').on('click', tableSelectAll);
$('#insert_priv_all').on('click', tableSelectAll);
$('#update_priv_all').on('click', tableSelectAll);
$('#references_priv_all').on('click', tableSelectAll);
var windowWidth = $(window).width();
$('.jsresponsive').css('max-width', (windowWidth - 35) + 'px');

View File

@ -23,6 +23,12 @@
{% endfor %}
</select>
<div>
<button class="btn btn-link p-0" id="select_priv_all" type="button" data-select-target="#select_select_priv">
{% trans 'Select all' %}
</button>
</div>
<em>{% trans 'Or' %}</em>
<label for="checkbox_Select_priv_none">
<input type="checkbox" name="Select_priv_none" id="checkbox_Select_priv_none" title="
@ -44,6 +50,12 @@
{% endfor %}
</select>
<div>
<button class="btn btn-link p-0" id="insert_priv_all" type="button" data-select-target="#select_insert_priv">
{% trans 'Select all' %}
</button>
</div>
<em>{% trans 'Or' %}</em>
<label for="checkbox_Insert_priv_none">
<input type="checkbox" name="Insert_priv_none" id="checkbox_Insert_priv_none" title="
@ -65,6 +77,12 @@
{% endfor %}
</select>
<div>
<button class="btn btn-link p-0" id="update_priv_all" type="button" data-select-target="#select_update_priv">
{% trans 'Select all' %}
</button>
</div>
<em>{% trans 'Or' %}</em>
<label for="checkbox_Update_priv_none">
<input type="checkbox" name="Update_priv_none" id="checkbox_Update_priv_none" title="
@ -86,6 +104,12 @@
{% endfor %}
</select>
<div>
<button class="btn btn-link p-0" id="references_priv_all" type="button" data-select-target="#select_references_priv">
{% trans 'Select all' %}
</button>
</div>
<em>{% trans 'Or' %}</em>
<label for="checkbox_References_priv_none">
<input type="checkbox" name="References_priv_none" id="checkbox_References_priv_none" title="