-
Notifications
You must be signed in to change notification settings - Fork 70
Expand file tree
/
Copy pathadmin.js
More file actions
45 lines (37 loc) · 1.5 KB
/
admin.js
File metadata and controls
45 lines (37 loc) · 1.5 KB
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
$(document).ready(function() {
function saveSettings() {
OC.msg.startSaving('#activity_notifications_msg');
var post = $('#activity_notifications').serialize();
$.post(OC.generateUrl('/apps/activity/settings/admin'), post, function(response) {
OC.msg.finishedSuccess('#activity_notifications_msg', response.data.message);
});
}
var $activityNotifications = $('#activity_notifications');
$activityNotifications.find('input[type=checkbox]').change(saveSettings);
$activityNotifications.find('select').change(saveSettings);
$activityNotifications.find('.activity_select_group').click(function() {
var $selectGroup = '#activity_notifications .' + $(this).attr('data-select-group');
var $filteredBoxes = $($selectGroup).not(':disabled');
var $checkedBoxes = $filteredBoxes.filter(':checked').length;
$filteredBoxes.prop('checked', true);
if ($checkedBoxes === $filteredBoxes.filter(':checked').length) {
// All values were already selected, so invert it
$filteredBoxes.prop('checked', false);
}
saveSettings();
});
$('#activity_email_enabled').on('change', function() {
OCP.AppConfig.setValue(
'activity', 'enable_email',
$(this).attr('checked') === 'checked' ? 'yes' : 'no'
);
});
$('#activity_system_users_group_list').each(function (index, element) {
OC.Settings.setupGroupsSelect($(element));
$(element).change(function(ev) {
var groups = ev.val || [];
groups = JSON.stringify(groups);
OCP.AppConfig.setValue('activity', $(this).attr('name'), groups);
});
});
});