Display the calendar in full height (w/ scroll).

This commit is contained in:
Daru13 2018-11-24 03:18:01 +01:00
parent 41b640a1ea
commit eb8f82f6c4
2 changed files with 23 additions and 2 deletions

View file

@ -30,7 +30,7 @@
top: 0; top: 0;
left: 0; left: 0;
width: 100%; width: 100%;
height: 100%; height: calc(100% + 30px + 10px);
padding: 0; padding: 0;
z-index: 10; z-index: 10;
} }
@ -84,7 +84,7 @@
#cal-container .cal-event-container { #cal-container .cal-event-container {
display: grid; display: grid;
/* grid-template-columns: repeat(24, 1fr); */ /* grid-template-columns: repeat(24, 1fr); */
grid-template-rows: repeat(12, auto); /* grid-template-rows: repeat(12, auto); */
position: absolute; position: absolute;
top: 40px; top: 40px;
@ -97,6 +97,7 @@
#cal-container .cal-event { #cal-container .cal-event {
position: relative; position: relative;
height: 80px;
margin: 2px 0; margin: 2px 0;
/* padding: 5px; */ /* padding: 5px; */
/* background-color: #EFEFEF; */ /* background-color: #EFEFEF; */

View file

@ -64,6 +64,7 @@ class Calendar {
this.updateEventLocationStyleID(); this.updateEventLocationStyleID();
this.sortEventNodesByEndTimeAndLocation(); this.sortEventNodesByEndTimeAndLocation();
this.updateCalendarNodeHeight();
} }
@ -76,6 +77,7 @@ class Calendar {
this.updateEventContainerGridStyle(); this.updateEventContainerGridStyle();
this.updateTimeSlots(); this.updateTimeSlots();
this.updateEventVisibilities(); this.updateEventVisibilities();
this.updateCalendarNodeHeight();
} }
setEndDate (newEndDate) { setEndDate (newEndDate) {
@ -85,6 +87,7 @@ class Calendar {
this.updateEventContainerGridStyle(); this.updateEventContainerGridStyle();
this.updateTimeSlots(); this.updateTimeSlots();
this.updateEventVisibilities(); this.updateEventVisibilities();
this.updateCalendarNodeHeight();
} }
updateHoursToDisplay () { updateHoursToDisplay () {
@ -93,6 +96,23 @@ class Calendar {
this.nbHoursToDisplay = Math.floor(computeDateDifferenceInHours(this.startDate, this.endDate)); this.nbHoursToDisplay = Math.floor(computeDateDifferenceInHours(this.startDate, this.endDate));
} }
// Calendar container
updateCalendarNodeHeight () {
// Time slot hour row
let timeSlotHourRowHeight = $(".cal-time-slot-hour").outerHeight();
// Event grid
let eventContainerHeight = $(".cal-event-container")
.css("grid-template-rows")
.split("px ")
.reduce((heightAccumulator, currentRowHeight) => {
return heightAccumulator + parseInt(currentRowHeight);
}, 0);
this.containerNode.css("height", timeSlotHourRowHeight + eventContainerHeight);
} }