Archived
1
0
This repository has been archived on 2020-12-10. You can view files and clone it, but cannot push or open issues or pull requests.
old/assets/js/user-edit.js

28 lines
719 B
JavaScript

$('.group-all').change(function () {
const v = $(this).is(':checked');
const items = $(this).parent().next('ul').children();
items.each(function () {
$(this).find('input[type=checkbox]').prop('checked', v);
});
});
$('input[type=checkbox]:not(.group-all)').change(function () {
const groupAll = $(this).parent().parent().prev('h4').find('.group-all');
if(!$(this).is(':checked')) {
groupAll.prop('checked', false);
} else {
const siblings = $(this).parent().siblings().find('input[type=checkbox]:not(:checked)');
if(siblings.length === 0) {
groupAll.prop('checked', true);
}
}
});
function checkSiblings() {
}
$(function () {
});