From 1546ff45f55607e161aacd93de753abed1c3780c Mon Sep 17 00:00:00 2001 From: Christian Hofmaier Date: Tue, 30 Oct 2018 13:47:22 +0100 Subject: [locationinfo] show overlapping events - when events overlap by time, show them separately - when two events dont differ in title, start and end, merge them --- .../locationinfo/templates/frontend-default.html | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'modules-available/locationinfo') diff --git a/modules-available/locationinfo/templates/frontend-default.html b/modules-available/locationinfo/templates/frontend-default.html index 1e1a3ce6..d1ecaae8 100755 --- a/modules-available/locationinfo/templates/frontend-default.html +++ b/modules-available/locationinfo/templates/frontend-default.html @@ -771,7 +771,9 @@ optional: timeSeparator: " - ", startOnFirstDayOfWeek: false, displayFreeBusys: true, - defaultFreeBusy: {free: false} + defaultFreeBusy: {free: false}, + allowCalEventOverlap: true, + overlapEventsSeparate: true }); } @@ -919,7 +921,7 @@ optional: const SEVEN_DAYS = 7 * 86400 * 1000; /** - * applays new calendar data to the calendar plugin and also saves it to the room object + * applies new calendar data to the calendar plugin and also saves it to the room object * @param {Array} json Calendar data * @param room Room Object */ @@ -946,9 +948,14 @@ optional: console.log('Notice: Calendar has no current events for ' + room.name); } try { + for (var i = json.length - 1; i > 0; i--) { + // if title, start and end are the same, "merge" two events by removing one of them + if (json[i].title === json[i-1].title && json[i].start === json[i-1].start && json[i].end === json[i-1].end) { + json.splice(i, 1); + } + } room.timetable = json; if (room.config.mode !== 3) { - // TODO: Check if they're the same var cal = room.$.calendar; cal.weekCalendar('option', 'data', {events: json}); cal.weekCalendar("refresh"); -- cgit v1.2.3-55-g7522