[TikiWiki-commits] [Git][tikiwiki/tiki][30.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 | <6a2c4bc7c7809_3819625c3876c@gitlab-sidekiq-low-urgency-cpu-bound-v2-5b88f8847b-7rxgh.mail> |
Adrien Mbuya Maloba pushed to branch 30.x at Tiki Wiki CMS Groupware / Tiki
Commits:
3de0bcdb by Adrien Mbuya Maloba at 2026-06-12T21:05:25+03:00
[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
- - - - -
1 changed file:
- src/js/jquery-tiki/eventcalendar_to_pdf.js
Changes:
=====================================
src/js/jquery-tiki/eventcalendar_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";
import html2canvas from "html2canvas-pro";
@@ -27,9 +26,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;
@@ -37,7 +36,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;
@@ -46,7 +45,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/3de0bcdbc0ae595386f50548d12aabd6152613f5
--
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/3de0bcdbc0ae595386f50548d12aabd6152613f5
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