From efbb9648c4f2a6e738cf432ae9b0b56cce7e0cf3 Mon Sep 17 00:00:00 2001 From: Kristof Rado Date: Mon, 1 Jun 2020 20:23:59 +0200 Subject: [PATCH] Introduce new function for location title shortening. --- modules/default/calendar/calendar.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/modules/default/calendar/calendar.js b/modules/default/calendar/calendar.js index 7d51ed88..f5ecab70 100755 --- a/modules/default/calendar/calendar.js +++ b/modules/default/calendar/calendar.js @@ -389,7 +389,7 @@ Module.register("calendar", { var descCell = document.createElement("td"); descCell.className = "location"; descCell.colSpan = "2"; - descCell.innerHTML = this.titleTransform(event.location); + descCell.innerHTML = this.locationTitleShorten(event.location); locationRow.appendChild(descCell); wrapper.appendChild(locationRow); @@ -736,6 +736,19 @@ Module.register("calendar", { 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() * Broadcasts the events to all other modules for reuse. * The all events available in one array, sorted on startdate.