Display event notes in the popup widget (#745).

This commit is contained in:
Alex Tselegidis 2020-07-01 09:13:22 +02:00
parent d8a7318c95
commit 16c18f9b99
2 changed files with 54 additions and 12 deletions

View file

@ -270,6 +270,21 @@ window.BackendCalendarDefaultView = window.BackendCalendarDefaultView || {};
return (result > 500) ? result : 500; // Minimum height is 500px
}
/**
* Get the event notes for the popup widget.
*
* @param {Event} event
*/
function getEventNotes(event) {
if (!event.data || !event.data.notes) {
return '-';
}
var notes = event.data.notes;
return notes.length > 100 ? notes.substring(0, 100) + '...' : notes;
}
/**
* Calendar Event "Click" Callback
*
@ -296,11 +311,6 @@ window.BackendCalendarDefaultView = window.BackendCalendarDefaultView || {};
&& GlobalVariables.user.privileges.appointments.delete === true)
? '' : 'hide'; // Same value at the time.
var notes = '';
if (event.data) { // Only custom unavailable periods have notes.
notes = '<strong>Notes</strong> ' + event.data.notes;
}
$html = $('<div/>', {
'html': [
$('<strong/>', {
@ -319,8 +329,11 @@ window.BackendCalendarDefaultView = window.BackendCalendarDefaultView || {};
}),
$('<br/>'),
$('<strong/>', {
'text': EALang.notes
}),
$('<span/>', {
'text': notes
'text': getEventNotes(event)
}),
$('<br/>'),
@ -485,6 +498,14 @@ window.BackendCalendarDefaultView = window.BackendCalendarDefaultView || {};
}),
$('<br/>'),
$('<strong/>', {
'text': EALang.notes
}),
$('<span/>', {
'text': getEventNotes(event)
}),
$('<br/>'),
$('<hr/>'),
$('<div/>', {

View file

@ -997,6 +997,21 @@ window.BackendCalendarTableView = window.BackendCalendarTableView || {};
}
}
/**
* Get the event notes for the popup widget.
*
* @param {Event} event
*/
function getEventNotes(event) {
if (!event.data || !event.data.notes) {
return '-';
}
var notes = event.data.notes;
return notes.length > 100 ? notes.substring(0, 100) + '...' : notes;
}
/**
* Calendar Event "Click" Callback
*
@ -1023,11 +1038,6 @@ window.BackendCalendarTableView = window.BackendCalendarTableView || {};
&& GlobalVariables.user.privileges.appointments.delete === true)
? '' : 'hide'; // Same value at the time.
var notes = '';
if (event.data) { // Only custom unavailable periods have notes.
notes = '<strong>Notes</strong> ' + event.data.notes;
}
$html = $('<div/>', {
'html': [
$('<strong/>', {
@ -1046,8 +1056,11 @@ window.BackendCalendarTableView = window.BackendCalendarTableView || {};
}),
$('<br/>'),
$('<strong/>', {
'text': EALang.notes
}),
$('<span/>', {
'text': notes
'text': getEventNotes(event)
}),
$('<br/>'),
@ -1212,6 +1225,14 @@ window.BackendCalendarTableView = window.BackendCalendarTableView || {};
}),
$('<br/>'),
$('<strong/>', {
'text': EALang.notes
}),
$('<span/>', {
'text': getEventNotes(event)
}),
$('<br/>'),
$('<hr/>'),
$('<div/>', {