diff --git a/civicrm-ux.php b/civicrm-ux.php index 4808a7c..7d782fd 100755 --- a/civicrm-ux.php +++ b/civicrm-ux.php @@ -9,7 +9,7 @@ * Plugin Name: WP CiviCRM UX * Plugin URI: https://github.com/agileware/wp-civicrm-ux * Description: A better user experience for integrating WordPress and CiviCRM - * Version: 1.6.2 + * Version: 1.7.0 * Author: Agileware * Author URI: https://agileware.com.au/ * License: GPL-2.0+ @@ -24,7 +24,7 @@ * Start at version 1.0.0 and use SemVer - https://semver.org * Rename this for your plugin and update it as you release new versions. */ -define( 'CIVICRM_UXVERSION', '1.6.2' ); +define( 'CIVICRM_UXVERSION', '1.7.0' ); // If this file is called directly, abort. if ( ! defined( 'WPINC' ) ) { diff --git a/public/js/event-fullcalendar.js b/public/js/event-fullcalendar.js new file mode 100644 index 0000000..a242c63 --- /dev/null +++ b/public/js/event-fullcalendar.js @@ -0,0 +1,40 @@ +const domevent = function(eventName, detail) { + if (typeof Window.CustomEvent === "function") { + return new CustomEvent(eventName, { bubbles: true, cancelable: true, detail }); + } else { + const event = document.createEvent('CustomEvent'); + event.initCustomEvent(eventName, true, true, detail); + return event; + } +}; + + +document.addEventListener('DOMContentLoaded', function() { + const calendarEl = document.getElementById('civicrm-event-fullcalendar'); + + let calendarParams = ({ + initialView: 'dayGridMonth', + events: { + url: '/civicrm/event/ical?reset=1&list=1', + format: 'ics', + }, + eventTimeFormat: { + hour: 'numeric', + minute: '2-digit', + omitZeroMinute: false, + meridiem: 'short' + }, + headerToolbar: { + start: 'title', + center: '', + end: 'dayGridMonth,listMonth,timeGridWeek,timeGridDay today prev,next' + } + }); + + calendarEl.dispatchEvent(domevent('fullcalendar:buildparams', calendarParams)); + + const calendar = new FullCalendar.Calendar(calendarEl, calendarParams); + + calendarEl.dispatchEvent(domevent('fullcalendar:prerender')); + calendar.render(); +}); diff --git a/shortcodes/event/event-fullcalendar.php b/shortcodes/event/event-fullcalendar.php new file mode 100644 index 0000000..c19be7c --- /dev/null +++ b/shortcodes/event/event-fullcalendar.php @@ -0,0 +1,27 @@ +'; + } +}