#1171: The `textarea` is showing and is working as intended for the purpose of

creating and updating the calendar event.

BUG: carriage returns don't seem to work
WIP: the text is hardcoded as of now, have to use Messages library for
translations.
This commit is contained in:
Fabrice Mouhartem 2023-10-18 18:14:06 +02:00 committed by Fabrice Mouhartem
parent c354abb1e2
commit 53ad4f5a25
2 changed files with 49 additions and 2 deletions

View File

@ -209,9 +209,13 @@
.tui-full-calendar-section-date-dash { .tui-full-calendar-section-date-dash {
height: auto; height: auto;
} }
.tui-full-calendar-section-title, .tui-full-calendar-section-location { .tui-full-calendar-section-title, .tui-full-calendar-section-location, .tui-full-calendar-section-description {
width: 100%; width: 100%;
} }
.tui-full-calendar-section-description textarea {
width: 100%;
height: 200px;
}
.tui-full-calendar-dropdown-menu { .tui-full-calendar-dropdown-menu {
top: 38px; top: 38px;
width: 221px; // same as button width: 221px; // same as button

View File

@ -99,6 +99,7 @@ define([
}; };
var newEvent = function (event, cb) { var newEvent = function (event, cb) {
var reminders = APP.notificationsEntries; var reminders = APP.notificationsEntries;
var description = APP.description;
var startDate = event.start._date; var startDate = event.start._date;
var endDate = event.end._date; var endDate = event.end._date;
@ -113,6 +114,7 @@ define([
isAllDay: event.isAllDay, isAllDay: event.isAllDay,
end: +endDate, end: +endDate,
reminders: reminders, reminders: reminders,
description: description,
recurrenceRule: event.recurrenceRule recurrenceRule: event.recurrenceRule
}; };
@ -283,6 +285,7 @@ define([
var obj = data.content[uid]; var obj = data.content[uid];
obj.title = obj.title || ""; obj.title = obj.title || "";
obj.location = obj.location || ""; obj.location = obj.location || "";
obj.description = obj.description || "";
if (obj.isAllDay && obj.startDay) { obj.start = +Flatpickr.parseDate((obj.startDay)); } if (obj.isAllDay && obj.startDay) { obj.start = +Flatpickr.parseDate((obj.startDay)); }
if (obj.isAllDay && obj.endDay) { if (obj.isAllDay && obj.endDay) {
var endDate = Flatpickr.parseDate(obj.endDay); var endDate = Flatpickr.parseDate(obj.endDay);
@ -1023,6 +1026,9 @@ ICS ==> create a new event with the same UID and a RECURRENCE-ID field (with a v
if (JSONSortify(oldRec || '') !== JSONSortify(rec)) { if (JSONSortify(oldRec || '') !== JSONSortify(rec)) {
changes.recurrenceRule = rec; changes.recurrenceRule = rec;
} }
var description = APP.description;
changes.description = description;
} }
@ -1900,7 +1906,6 @@ APP.recurrenceRule = {
var getNotificationDropdown = function () { var getNotificationDropdown = function () {
var ev = APP.editModalData; var ev = APP.editModalData;
var calId = ev.selectedCal.id; var calId = ev.selectedCal.id;
// DEFAULT HERE [10] ==> 10 minutes before the event
var id = (ev.id && ev.id.split('|')[0]) || undefined; var id = (ev.id && ev.id.split('|')[0]) || undefined;
var _ev = APP.calendar.getSchedule(ev.id, calId); var _ev = APP.calendar.getSchedule(ev.id, calId);
var oldReminders = _ev && _ev.raw && _ev.raw.reminders; var oldReminders = _ev && _ev.raw && _ev.raw.reminders;
@ -2008,6 +2013,41 @@ APP.recurrenceRule = {
]); ]);
}; };
var getDescriptionInput = function() {
var ev = APP.editModalData;
var calId = ev.selectedCal.id;
// DEFAULT HERE [10] ==> 10 minutes before the event
var id = (ev.id && ev.id.split('|')[0]) || undefined;
var _ev = APP.calendar.getSchedule(ev.id, calId);
var oldDescription = _ev && _ev.raw && _ev.raw.description;
if (!oldDescription) {
oldDescription = Util.find(APP.calendars, [calId, 'content', 'content', id, 'description']) || "";
}
APP.description = oldDescription;
var description = h('textarea.tui-full-calendar-content', {
placeholder: 'Description', // TODO: replace with Message.calendar_description
id: 'tui-full-calendar-description',
});
description.value = oldDescription;
var updateDescription = function(value) {
APP.description = value;
};
var $description = $(description);
$description.on('input', function() {
updateDescription(description.value);
});
return h('div.tui-full-calendar-popup-section.tui-full-calendar-vlayout-area', [
h('div.tui-full-calendar-popup-section-item.tui-full-calendar-section-description', [
description,
]),
]);
};
var createToolbar = function () { var createToolbar = function () {
var displayed = ['useradmin', 'newpad', 'limit', 'pageTitle', 'notifications']; var displayed = ['useradmin', 'newpad', 'limit', 'pageTitle', 'notifications'];
var configTb = { var configTb = {
@ -2118,6 +2158,9 @@ APP.recurrenceRule = {
var div = getNotificationDropdown(); var div = getNotificationDropdown();
$button.before(div); $button.before(div);
var descriptionInput = getDescriptionInput();
$startDate.parent().parent().before(descriptionInput);
// Use Flatpickr with or without time depending on allday checkbox // Use Flatpickr with or without time depending on allday checkbox
var $cbox = $el.find('#tui-full-calendar-schedule-allday'); var $cbox = $el.find('#tui-full-calendar-schedule-allday');
var allDay = $cbox.is(':checked'); var allDay = $cbox.is(':checked');