[TikiWiki-commits] [Git][tikiwiki/tiki][29.x] [BP][ENH] Calendar: use visible calendar title for PDF export

"Adrien Mbuya Maloba \(@adrienmaloba\) via TikiWiki-cvs" <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <6a2d8f1692123_381962e879748@gitlab-sidekiq-low-urgency-cpu-bound-v2-c9f44b7d4-rt2s2.mail>

Adrien Mbuya Maloba pushed to branch 29.x at Tiki Wiki CMS Groupware / Tiki


Commits:
86178f54 by Adrien Mbuya Maloba at 2026-06-13T20:05:06+03:00
[BP][ENH] Calendar: use visible calendar title for PDF export
---
* [BP][ENH] Calendar: use visible calendar title for PDF export
---
* [ENH] Calendar: use visible calendar title for PDF export
---
* [ENH] Calendar: use visible calendar title for PDF export

See merge request tikiwiki/tiki!10176

See merge request tikiwiki/tiki!10505

See merge request tikiwiki/tiki!10513

- - - - -


1 changed file:

- src/js/jquery-tiki/fullcalendar_to_pdf.js


Changes:

=====================================
src/js/jquery-tiki/fullcalendar_to_pdf.js
=====================================
@@ -3,7 +3,6 @@
 // All Rights Reserved. See copyright.txt for details and a complete list of authors.
 // Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
 
-import moment from "moment";
 import { jsPDF } from "common-reexported/jspdf";
 
 $.fn.addEventCalendarPrint = function (buttonId, calendar) {
@@ -26,9 +25,9 @@ $.fn.addEventCalendarPrint = function (buttonId, calendar) {
                 scrollY: 0,
                 scrollX: 0,
             }).then(function (canvas) {
-                var date = moment(calendar.date);
-                var monthName = date.format("MMMM");
-                var year = date.format("YYYY");
+                var calendarTitle = $(calendarId + " .ec-title")
+                    .text()
+                    .trim();
                 var imgData = canvas.toDataURL("image/jpeg", 1.0);
                 var imgWidth = 180;
                 var pageHeight = 250;
@@ -36,7 +35,7 @@ $.fn.addEventCalendarPrint = function (buttonId, calendar) {
                 var heightLeft = imgHeight;
                 var doc = new jsPDF("p", "mm");
                 doc.setFontSize(14);
-                doc.text((210 - imgWidth) / 2, 20, monthName + " " + year);
+                doc.text((210 - imgWidth) / 2, 20, calendarTitle.replace(/\s+/g, " "));
 
                 if (imgHeight > pageHeight) {
                     imgHeight = pageHeight;
@@ -45,7 +44,7 @@ $.fn.addEventCalendarPrint = function (buttonId, calendar) {
 
                 doc.addImage(imgData, "JPEG", (210 - imgWidth) / 2, 30, imgWidth, heightLeft > pageHeight ? pageHeight : heightLeft);
 
-                doc.save(monthName + year + ".pdf");
+                doc.save(calendarTitle + ".pdf");
             });
         }, 200);
     });



View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/86178f54b1e81106344019b7bc0b1788210270e6

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/86178f54b1e81106344019b7bc0b1788210270e6
You're receiving this email because of your account on gitlab.com. Manage all notifications: https://gitlab.com/-/profile/notifications | Help: https://gitlab.com/help

_______________________________________________
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.