mirror of https://git.48k.eu/ogcp
js: allow selection of multiple clients in scopes sidebar
Allow the selection of multiple client checkboxes if they belong to the same room. Each checkbox input in the DOM has a "data-parent-room" attribute whose value is the value of the "name" attribute of its parent room scope component. To check if a checkbox is a client and a sibling of the one being checked we check if "data-parent-room" is available for both nodes and if they have the same value.master
parent
37ae1bc5a2
commit
5d9780e8d8
|
@ -399,8 +399,21 @@ function limitCheckboxes(context) {
|
|||
const checkboxes = $('input:checkbox[form|="scopesForm"]');
|
||||
|
||||
checkboxes.on('change', function () {
|
||||
const checked = this;
|
||||
checkboxes.filter((i, c) => c !== checked).prop('checked', false);
|
||||
const currentCheckbox = $(this);
|
||||
const currentParentRoom = currentCheckbox.attr('data-parent-room');
|
||||
|
||||
checkboxes.each(function () {
|
||||
const checkbox = $(this);
|
||||
const checkboxParentRoom = checkbox.attr('data-parent-room');
|
||||
|
||||
if (currentCheckbox.is(checkbox)) {
|
||||
return;
|
||||
}
|
||||
const isSibling = currentParentRoom && checkboxParentRoom && checkboxParentRoom === currentParentRoom;
|
||||
if (!isSibling) {
|
||||
checkbox.prop('checked', false);
|
||||
}
|
||||
});
|
||||
|
||||
checkScopeServer();
|
||||
|
||||
|
|
|
@ -111,7 +111,7 @@
|
|||
<!-- ChartJS -->
|
||||
<script src="{{ url_for('static', filename='AdminLTE/plugins/chart.js/Chart.min.js') }}"></script>
|
||||
|
||||
<script src="{{ url_for('static', filename='js/ogcp.js') }}?v=7"></script>
|
||||
<script src="{{ url_for('static', filename='js/ogcp.js') }}?v=8"></script>
|
||||
|
||||
<script>
|
||||
// error messages
|
||||
|
|
Loading…
Reference in New Issue