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/CalendarGroupFilter.php | 21 ++++++++++++++++++ app/php/controls/CalendarGroupFilter.tpl | 16 ++++++++++++++ app/php/controls/scripts/CalendarGroupFilter.js | 29 +++++++++++++++++++++++++ 3 files changed, 66 insertions(+) create mode 100644 app/php/controls/CalendarGroupFilter.php create mode 100644 app/php/controls/CalendarGroupFilter.tpl create mode 100644 app/php/controls/scripts/CalendarGroupFilter.js diff --git a/app/php/controls/CalendarGroupFilter.php b/app/php/controls/CalendarGroupFilter.php new file mode 100644 index 0000000..6f19bcd --- /dev/null +++ b/app/php/controls/CalendarGroupFilter.php @@ -0,0 +1,21 @@ +Categories->DataSource = $this->Facade->getCategories(); + $this->Categories->dataBind(); + } + + public function getPradoScriptDependencies() { + return ['jquery']; + } + +} + +?> diff --git a/app/php/controls/CalendarGroupFilter.tpl b/app/php/controls/CalendarGroupFilter.tpl new file mode 100644 index 0000000..e9ae79a --- /dev/null +++ b/app/php/controls/CalendarGroupFilter.tpl @@ -0,0 +1,16 @@ + + +
+ All + +
+
+ +
+ <%# $this->Data->Name %> + + <%# $this->Data->ID %> + +
+
+
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.2.3