aboutsummaryrefslogtreecommitdiffstats
path: root/view/js/mod_defperms.js
blob: 18ebe268e36f1f1d0828e896d514ce3ea7ac2e02 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
$(document).ready(function() {

	$('#id_permcat').change(function() {
		$('.loading').toggleClass('invisible');
		var permName = $('#id_permcat').val();
		loadConnectionRole(permName);
	});


});


function loadConnectionRole(name) {

	if(! name)
		name = 'default';

	$('.defperms-edit input').each(function() {
		if(! $(this).is(':disabled'))
			$(this).removeAttr('checked');
	});

	$.get('permcat/' + name, function(data) {
		$(data.perms).each(function() {
			if(this.value)
				$('#id_perms_' + this.name).attr('checked','checked');
		});
		$('.loading').toggleClass('invisible');
	});
}