From e4cc2fc76021f983634ff8aa04e4a1cf1d77db06 Mon Sep 17 00:00:00 2001 From: Alex Tselegidis Date: Fri, 17 May 2024 20:13:58 +0200 Subject: [PATCH] Add custom render method that can be easily overriden --- assets/js/utils/calendar_default_view.js | 6 ++++++ assets/js/utils/calendar_event_popover.js | 12 ++++++++++++ assets/js/utils/calendar_table_view.js | 6 ++++++ 3 files changed, 24 insertions(+) diff --git a/assets/js/utils/calendar_default_view.js b/assets/js/utils/calendar_default_view.js index c7126265fd..36857e9a68 100755 --- a/assets/js/utils/calendar_default_view.js +++ b/assets/js/utils/calendar_default_view.js @@ -419,6 +419,8 @@ App.Utils.CalendarDefaultView = (function () { }), $('
'), + App.Utils.CalendarEventPopover.renderCustomContent(info), + $('
'), $('
', { @@ -521,6 +523,8 @@ App.Utils.CalendarDefaultView = (function () { }), $('
'), + App.Utils.CalendarEventPopover.renderCustomContent(info), + $('
'), $('
', { @@ -689,6 +693,8 @@ App.Utils.CalendarDefaultView = (function () { }), $('
'), + App.Utils.CalendarEventPopover.renderCustomContent(info), + $('
'), $('
', { diff --git a/assets/js/utils/calendar_event_popover.js b/assets/js/utils/calendar_event_popover.js index bd9dcffe44..32408c0de9 100644 --- a/assets/js/utils/calendar_event_popover.js +++ b/assets/js/utils/calendar_event_popover.js @@ -120,9 +120,21 @@ App.Utils.CalendarEventPopover = (function () { }).html(); } + /** + * Render custom content into the popover of events. + * + * @param {Object} info The info object as passed from FullCalendar + * + * @return {Object|String|null} Return HTML string, a jQuery selector or null for nothing. + */ + function renderCustomContent(info) { + return null; // Default behavior + } + return { renderPhoneIcon, renderMapIcon, renderMailIcon, + renderCustomContent, }; })(); diff --git a/assets/js/utils/calendar_table_view.js b/assets/js/utils/calendar_table_view.js index 292f9ea456..2cbd2f746a 100755 --- a/assets/js/utils/calendar_table_view.js +++ b/assets/js/utils/calendar_table_view.js @@ -1146,6 +1146,8 @@ App.Utils.CalendarTableView = (function () { }), $('
'), + App.Utils.CalendarEventPopover.renderCustomContent(info), + $('
'), $('
', { @@ -1251,6 +1253,8 @@ App.Utils.CalendarTableView = (function () { }), $('
'), + App.Utils.CalendarEventPopover.renderCustomContent(info), + $('
'), $('
', { @@ -1416,6 +1420,8 @@ App.Utils.CalendarTableView = (function () { }), $('
'), + App.Utils.CalendarEventPopover.renderCustomContent(info), + $('
'), $('
', {