You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
1.0 KiB
29 lines
1.0 KiB
$(document).ready(function() { |
|
function saveSettings() { |
|
OC.msg.startSaving('#activity_notifications_msg'); |
|
var post = $('#activity_notifications').serialize(); |
|
|
|
$.post(OC.generateUrl('/apps/activity/settings'), 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(); |
|
}); |
|
});
|
|
|