diff options
author | Christian Hofmaier | 2018-10-30 13:47:22 +0100 |
---|---|---|
committer | Christian Hofmaier | 2018-10-30 13:47:22 +0100 |
commit | 1546ff45f55607e161aacd93de753abed1c3780c (patch) | |
tree | 6b7227ee3e01b5d0c68a66370ee8f627a5cad158 | |
parent | [locationinfo] scale calender if no events in timetable (diff) | |
download | slx-admin-1546ff45f55607e161aacd93de753abed1c3780c.tar.gz slx-admin-1546ff45f55607e161aacd93de753abed1c3780c.tar.xz slx-admin-1546ff45f55607e161aacd93de753abed1c3780c.zip |
[locationinfo] show overlapping events
- when events overlap by time, show them separately
- when two events dont differ in title, start and end, merge them
-rwxr-xr-x | modules-available/locationinfo/templates/frontend-default.html | 13 |
1 files changed, 10 insertions, 3 deletions
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"); |