summaryrefslogtreecommitdiff
path: root/app/php/controls/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'app/php/controls/scripts')
-rw-r--r--app/php/controls/scripts/CalendarGroupFilter.js29
1 files changed, 29 insertions, 0 deletions
diff --git a/app/php/controls/scripts/CalendarGroupFilter.js b/app/php/controls/scripts/CalendarGroupFilter.js
new file mode 100644
index 0000000..e6c1d73
--- /dev/null
+++ b/app/php/controls/scripts/CalendarGroupFilter.js
@@ -0,0 +1,29 @@
+$(document).on('ready', function() {
+ var selectBoxes = $('.selectGroup input.box');
+ var selectAllBox = $('.selectAllGroups input.box');
+ selectBoxes.on('change', function() {
+ var groups = [];
+ var allSelected = true;
+ $('.selectGroup input.box').each(function() {
+ var box = $(this);
+ if (box.is(':checked')) {
+ groups.push(box.val());
+ } else {
+ allSelected = false;
+ }
+ });
+ if (allSelected) {
+ selectAllBox.prop('checked', true);
+ } else {
+ selectAllBox.removeAttr('checked');
+ }
+ $(document).trigger('Application.calendarGroupFilterChanged', {groups: groups});
+ });
+ selectAllBox.on('change', function() {
+ if ($(this).is(':checked')) {
+ selectBoxes.prop('checked', true).trigger('change');
+ } else {
+ selectBoxes.removeAttr('checked').trigger('change');
+ }
+ });
+});