Introduce new function for location title shortening.

This commit is contained in:
Kristof Rado
2020-06-01 20:23:59 +02:00
parent 3d73153e59
commit efbb9648c4

View File

@@ -389,7 +389,7 @@ Module.register("calendar", {
var descCell = document.createElement("td"); var descCell = document.createElement("td");
descCell.className = "location"; descCell.className = "location";
descCell.colSpan = "2"; descCell.colSpan = "2";
descCell.innerHTML = this.titleTransform(event.location); descCell.innerHTML = this.locationTitleShorten(event.location);
locationRow.appendChild(descCell); locationRow.appendChild(descCell);
wrapper.appendChild(locationRow); wrapper.appendChild(locationRow);
@@ -736,6 +736,19 @@ Module.register("calendar", {
return title; return title;
}, },
/*
* locationTitleShorten(title)
* Shortens the event location title based on config.maxTitleLength and config.wrapEvents
*
* argument title string - the event location title to shorten
*
* return string - The shortened title.
*/
locationTitleShorten: function (title) {
title = this.shorten(title, this.config.maxTitleLength, this.config.wrapEvents, this.config.maxTitleLines);
return title;
},
/* broadcastEvents() /* broadcastEvents()
* Broadcasts the events to all other modules for reuse. * Broadcasts the events to all other modules for reuse.
* The all events available in one array, sorted on startdate. * The all events available in one array, sorted on startdate.