diff options
author | MaZderMind | 2016-08-02 22:11:45 +0200 |
---|---|---|
committer | MaZderMind | 2016-08-02 22:11:45 +0200 |
commit | a91df33997fdac99c5f7ed8577adebda0a676ec2 (patch) | |
tree | af82971f84ad8f4575a864f754cb534b692b4403 | |
parent | 6c526bdf4a28ed6800a0bc827d9d55e215e19be8 (diff) |
place schedule elements absolute on calulated positions, fixes wrap-around bug
-rw-r--r-- | assets/css/_schedule.less | 5 | ||||
-rw-r--r-- | template/assemblies/schedule.phtml | 9 |
2 files changed, 10 insertions, 4 deletions
diff --git a/assets/css/_schedule.less b/assets/css/_schedule.less index 72ea294..6617432 100644 --- a/assets/css/_schedule.less +++ b/assets/css/_schedule.less @@ -10,6 +10,8 @@ .room { overflow: hidden; + position: relative; + height: 100px; } .now { @@ -32,7 +34,8 @@ .block { overflow: hidden; - float: left; + position: absolute; + top: 0; height: 100px; /* and now for small screens: */ diff --git a/template/assemblies/schedule.phtml b/template/assemblies/schedule.phtml index 482ea39..f913b64 100644 --- a/template/assemblies/schedule.phtml +++ b/template/assemblies/schedule.phtml @@ -1,15 +1,18 @@ <div class="schedule scroll-container"> <div class="scroll-element"> <div class="now"><span>now</span></div> - <? foreach($schedule->getSchedule() as $roomname => $events): ?> - <div class="room <? if($roomname == $room->getSlug()): ?>highlight<? endif ?>" style="width: <?=round($schedule->getDurationSum() / $schedule->getScale()) + 50?>px"> + <? $rooms = $schedule->getSchedule() ?> + <? foreach($rooms as $roomname => $events): ?> + <div class="room <? if($roomname == $room->getSlug()): ?>highlight<? endif ?>" style="width: <?=round($schedule->getDurationSum() / $schedule->getScale())?>px"> + <? $fromstart = 0; ?> <? foreach($events as $event): ?> <div class="block <?=h(@$event['special'] ?: 'event')?>" - style="width: <?=h(round($event['duration'] / $schedule->getScale()))?>px" + style="width: <?=h(round($event['duration'] / $schedule->getScale()))?>px; left: <?=h(round($fromstart / $schedule->getScale()))?>px" data-start="<?=intval($event['start'])?>" data-end="<?=intval($event['end'])?>" > + <? $fromstart += $event['duration'] ?> <? $scheduleRoom = Room::createIfExists($roomname) ?> <? if($scheduleRoom): ?> <a |