[TikiWiki-commits] [Git][tikiwiki/tiki][27.x] [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 | <6a02497055068_38190cd078637@gitlab-sidekiq-low-urgency-cpu-bound-v2-f4577dd4d-w9lbf.mail> |
Adrien Mbuya Maloba pushed to branch 27.x at Tiki Wiki CMS Groupware / Tiki
Commits:
a027ccc5 by Adrien Mbuya Maloba at 2026-05-12T00:20:12+03:00
[ENH] Calendar: use visible calendar title for PDF export
---
* [ENH] Calendar: use visible calendar title for PDF export
See merge request tikiwiki/tiki!10177
- - - - -
1 changed file:
- src/js/jquery-tiki/fullcalendar_to_pdf.js
Changes:
=====================================
src/js/jquery-tiki/fullcalendar_to_pdf.js
=====================================
@@ -3,8 +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";
-
$.fn.addFullCalendarPrint = function (buttonId, calendar) {
let viewContainer = $(this);
var calendarId = "#" + $(this).attr("id");
@@ -25,9 +23,9 @@ $.fn.addFullCalendarPrint = function (buttonId, calendar) {
scrollY: 0,
scrollX: 0,
}).then(function (canvas) {
- var date = moment(calendar.getDate());
- var monthName = date.format("MMMM");
- var year = date.format("YYYY");
+ var calendarTitle = $(calendarId + " .fc-toolbar-title")
+ .text()
+ .trim();
var imgData = canvas.toDataURL("image/jpeg", 1.0);
var imgWidth = 180;
var pageHeight = 250;
@@ -35,7 +33,7 @@ $.fn.addFullCalendarPrint = 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);
if (imgHeight > pageHeight) {
imgHeight = pageHeight;
@@ -44,7 +42,7 @@ $.fn.addFullCalendarPrint = 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/a027ccc5c749f3a980aa569c31d3644b18e7f665
--
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/a027ccc5c749f3a980aa569c31d3644b18e7f665
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