-
Notifications
You must be signed in to change notification settings - Fork 5
/
config_form.js
53 lines (47 loc) · 2.1 KB
/
config_form.js
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
Commenting = {
toggleCommentOptions: function() {
jQuery('div#non-public-options').toggle();
if(jQuery('#commenting_allow_public').prop('checked')) {
jQuery('div#commenting-moderate-public').show();
} else {
jQuery('div#commenting-moderate-public').removeAttr('checked');
jQuery('div#commenting-moderate-public').hide();
}
Commenting.toggleModerateOptions();
},
toggleViewOptions: function() {
jQuery('div.view-options').toggle();
},
toggleModerateOptions: function() {
if( jQuery('input#commenting_allow_public').prop('checked')) {
jQuery('div#commenting-moderate-public').show();
if(jQuery('input#commenting_require_public_moderation').prop('checked')) {
jQuery('div#moderate-options').show();
} else {
jQuery('div#moderate-options').hide();
}
} else {
jQuery('div#moderate-options').show();
jQuery('div#commenting-moderate-public').hide();
jQuery('input#commenting_require_public_moderation').removeAttr('checked');
}
}
};
jQuery(document).ready(function() {
jQuery('input#commenting_allow_public').click(Commenting.toggleCommentOptions);
jQuery('input#commenting_allow_public_view').click(Commenting.toggleViewOptions);
jQuery('input#commenting_require_public_moderation').click(Commenting.toggleModerateOptions);
//if public commenting is on
if(jQuery('input#commenting_allow_public').prop('checked')) {
jQuery('div#non-public-options').hide();
jQuery('div#commenting-moderate-public').show();
} else {
jQuery('div#commenting-moderate-public').hide();
jQuery('div#commenting-moderate-public').removeAttr('checked');
jQuery('div.moderate-options').show();
}
Commenting.toggleModerateOptions();
if(jQuery('input#commenting_allow_public_view').prop('checked')) {
jQuery('div.view-options').hide();
}
});