[TikiWiki-commits] [Git][tikiwiki/tiki][master] [FIX] Calendar: Show the modal of event editing form when clicking on the...

Benoit Grégoire (@benoitg) via TikiWiki-cvs <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <689269e2607d9_2cd5db834753@gitlab-sidekiq-low-urgency-cpu-bound-v2-86c757c9d6-5xqd9.mail>

Benoit Grégoire pushed to branch master at Tiki Wiki CMS Groupware / Tiki


Commits:
0f1cc2b2 by Adrien Mbuya Maloba at 2025-08-05T20:22:17+00:00
[FIX] Calendar: Show the modal of event editing form when clicking on the event in the calendar view and show the button to copy event link to clipboard
---
* [FIX] Calendar: Show the modal of event editing form when clicking on the event in the calendar view and show the button to copy event link to clipboard

See merge request tikiwiki/tiki!8121

- - - - -


3 changed files:

- lib/core/Services/Calendar/Controller.php
- src/js/jquery-tiki/tiki-calendar.js
- templates/tiki-calendar.tpl


Changes:

=====================================
lib/core/Services/Calendar/Controller.php
=====================================
@@ -209,17 +209,18 @@ class Services_Calendar_Controller extends Services_Calendar_BaseController
                             'fieldName' => 'description'
                         ]
                     ) : '',
-                    'categoryBackgroundColor' => $event['categoryBackgroundColor'] ? $event['categoryBackgroundColor'] : ''
+                    'categoryBackgroundColor' => $event['categoryBackgroundColor'] ? $event['categoryBackgroundColor'] : '',
+                    'showCopyButton' => $calendars[$event['calendarId']]['copybuttononeachevent'],
+                    'viewable'    => $event['perms']->view_events,
+                    'baseUrl'   => $base_url
                 ],
                 'url'         => $url,
                 'allDay'      => $allDay,
                 'start'       => $start->format(DATE_ATOM),
                 'end'         => $end->format(DATE_ATOM),
                 'editable'    => $event['perms']->change_events,
-                'color'       => '#' . $calendars[$event['calendarId']]['custombgcolor'],
+                'backgroundColor'       => '#' . $calendars[$event['calendarId']]['custombgcolor'],
                 'textColor'   => '#' . $calendars[$event['calendarId']]['customfgcolor'],
-                'showCopyButton' => $calendars[$event['calendarId']]['copybuttononeachevent'],
-                'baseUrl'   => $base_url
             ];
         }
         return $events;


=====================================
src/js/jquery-tiki/tiki-calendar.js
=====================================
@@ -95,7 +95,6 @@ $.fn.setupEventCalendar = function (eventCalendarParams) {
                         document.getElementById("semester").remove();
                     }
                     if (data.type == "timeGridWeek" || data.type == "listWeek") {
-                        console.log(calendar.getOption("duration"));
                         calendar.setOption("duration", { days: 7 });
                         calendar.setOption("dayCellFormat", function (dayCell) {
                             return moment(dayCell).format("D");
@@ -119,26 +118,15 @@ $.fn.setupEventCalendar = function (eventCalendarParams) {
             eventDidMount: function (arg) {
                 const event = arg.event;
                 const element = $(arg.el);
-                const dayGrid = $(".ec-daygrid").length;
+                const dayGrid = $(".ec-event").length;
                 if (dayGrid > 0) {
-                    let backgroundColor = event._def.ui.backgroundColor;
-                    let textColor = event._def.ui.textColor;
-                    let categoryBackgroundColor = event._def.extendedProps.categoryBackgroundColor;
-                    let eventDotElement = element.find(".ec-daygrid-event-dot"),
-                        defaultBackgroundColor;
-                    if (eventDotElement.length === 0) {
-                        eventDotElement = element;
-                    }
-                    const styleDot = getComputedStyle(eventDotElement[0]);
-                    const borderCol = styleDot.border || styleDot.borderColor || styleDot.borderTopColor || styleDot.borderTopColor;
-                    const matches = String(borderCol).match(/(rgb\(\d+,\s*\d+,\s*\d+\))/i) || ["rgb(55, 136, 216)"];
-                    defaultBackgroundColor = matches[0];
-                    if (eventDotElement !== element) {
-                        $(eventDotElement[0]).remove();
-                    }
+                    let backgroundColor = event.backgroundColor;
+                    let textColor = event.textColor;
+                    let categoryBackgroundColor = event.extendedProps.categoryBackgroundColor;
+                    let defaultBackgroundColor = element.css("background-color");
+
                     const titleElement = element.find(".ec-event-title");
-                    const styleElement = getComputedStyle(titleElement[0]);
-                    const defaultTextColor = styleElement.color;
+                    const defaultTextColor = titleElement.css("color");
                     if (backgroundColor === "#") {
                         backgroundColor = defaultBackgroundColor;
                     }
@@ -162,7 +150,7 @@ $.fn.setupEventCalendar = function (eventCalendarParams) {
                     $(element).find(".ec-event-title").css({
                         color: textColor,
                     });
-                    const showCopyButton = event._def.extendedProps.showCopyButton;
+                    const showCopyButton = event.extendedProps.showCopyButton;
                     if (showCopyButton === "y") {
                         const copyButton = $("<i>", {
                             id: "event" + event.id,
@@ -198,9 +186,7 @@ $.fn.setupEventCalendar = function (eventCalendarParams) {
             },
             eventClick: function (info) {
                 info.jsEvent.preventDefault();
-                console.log(info.el);
                 const event = info.event;
-                console.log(event);
                 if (event.id && event.extendedProps.viewable) {
                     let $this = $(info.el).tikiModal(" ");
                     $.openModal({
@@ -243,7 +229,6 @@ $.fn.setupEventCalendar = function (eventCalendarParams) {
                                         "submit",
                                         ajaxSubmitEventHandler(function (data) {
                                             calendarEditSubmit(data, this);
-                                            console.log(data);
                                         })
                                     );
                             },


=====================================
templates/tiki-calendar.tpl
=====================================
@@ -206,6 +206,7 @@
         .ec-event {
             display: block;
             white-space: break-spaces;
+            margin-top: 1px;
         }
         .ec-events .ec-event-time {
             color: #ffffff;



View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/0f1cc2b21ecc0366debfb588bdf3c1264b65122b

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/0f1cc2b21ecc0366debfb588bdf3c1264b65122b
You're receiving this email because of your account on gitlab.com.

_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.