diff options
author | emkael <emkael@tlen.pl> | 2016-05-09 10:37:30 +0200 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2016-05-09 12:38:03 +0200 |
commit | bd9ca1eea24cfa98c0bcbea1ee546d131d5c10c1 (patch) | |
tree | 5b6cc479f6a34a35eaa8afa8f027b75d19347e60 /app/php/controls/scripts | |
parent | 92e7aa7f13390e80c6f12f3be5676b80670b7728 (diff) |
* group filter control for calendars
Diffstat (limited to 'app/php/controls/scripts')
-rw-r--r-- | app/php/controls/scripts/CalendarGroupFilter.js | 29 |
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'); + } + }); +}); |