From bd9ca1eea24cfa98c0bcbea1ee546d131d5c10c1 Mon Sep 17 00:00:00 2001 From: emkael Date: Mon, 9 May 2016 10:37:30 +0200 Subject: * group filter control for calendars --- app/php/controls/scripts/CalendarGroupFilter.js | 29 +++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 app/php/controls/scripts/CalendarGroupFilter.js (limited to 'app/php/controls/scripts') 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'); + } + }); +}); -- cgit v1.3.1