@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Make calendar day view events fill up the correctly sized slots

Summary: Ref T4393, Make calendar day view events fill up the correctly sized slots. (not handling overlapping slots)

Test Plan: Create an event 4:30-5:30am. Day view should correctly reflect when event happens.

Reviewers: epriestley, #blessed_reviewers, chad

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Maniphest Tasks: T4393

Differential Revision: https://secure.phabricator.com/D12700

+29 -6
+2 -2
resources/celerity/map.php
··· 119 119 'rsrc/css/layout/phabricator-hovercard-view.css' => '44394670', 120 120 'rsrc/css/layout/phabricator-side-menu-view.css' => 'c1db9e9c', 121 121 'rsrc/css/layout/phabricator-source-code-view.css' => '2ceee894', 122 - 'rsrc/css/phui/calendar/phui-calendar-day.css' => 'a4df5b72', 122 + 'rsrc/css/phui/calendar/phui-calendar-day.css' => '75b8cc4a', 123 123 'rsrc/css/phui/calendar/phui-calendar-list.css' => 'c1d0ca59', 124 124 'rsrc/css/phui/calendar/phui-calendar-month.css' => 'a92e47d2', 125 125 'rsrc/css/phui/calendar/phui-calendar.css' => '8675968e', ··· 780 780 'phui-box-css' => '7b3a2eed', 781 781 'phui-button-css' => 'de610129', 782 782 'phui-calendar-css' => '8675968e', 783 - 'phui-calendar-day-css' => 'a4df5b72', 783 + 'phui-calendar-day-css' => '75b8cc4a', 784 784 'phui-calendar-list-css' => 'c1d0ca59', 785 785 'phui-calendar-month-css' => 'a92e47d2', 786 786 'phui-crumbs-view-css' => '594d719e',
+25 -3
src/view/phui/calendar/PHUICalendarDayView.php
··· 40 40 $hour_start = $hour->format('U'); 41 41 $hour_end = id(clone $hour)->modify('+1 hour')->format('U'); 42 42 foreach ($this->events as $event) { 43 + // check if start date is in hour slot 43 44 if ($event->getEpochStart() >= $hour_start 44 45 && $event->getEpochStart() < $hour_end) { 45 46 $events[] = $event; ··· 49 50 $count_events = count($events); 50 51 $event_boxes = array(); 51 52 $n = 0; 53 + // draw all events that start in this hour 54 + // all times as epochs 52 55 foreach ($events as $event) { 56 + $event_start = $event->getEpochStart(); 57 + $event_end = $event->getEpochEnd(); 58 + 53 59 $offset = (($n / $count_events) * 100).'%'; 54 60 $width = ((1 / $count_events) * 100).'%'; 55 - $event_boxes[] = $this->drawEvent($event, $offset, $width); 61 + $top = ((($event_start - $hour_start) / ($hour_end - $hour_start)) 62 + * 100).'%'; 63 + $height = ((($event_end - $event_start) / ($hour_end - $hour_start)) 64 + * 100).'%'; 65 + 66 + $event_boxes[] = $this->drawEvent( 67 + $event, 68 + $offset, 69 + $width, 70 + $top, 71 + $height); 56 72 $n++; 57 73 } 58 74 ··· 87 103 private function drawEvent( 88 104 AphrontCalendarDayEventView $event, 89 105 $offset, 90 - $width) { 106 + $width, 107 + $top, 108 + $height) { 91 109 $name = phutil_tag( 92 110 'a', 93 111 array( ··· 100 118 'div', 101 119 array( 102 120 'class' => 'phui-calendar-day-event', 103 - 'style' => 'left: '.$offset.'; width: '.$width.';', 121 + 'style' => 'left: '.$offset 122 + .'; width: '.$width 123 + .'; top: '.$top 124 + .'; height: '.$height 125 + .';', 104 126 ), 105 127 $name); 106 128
+2 -1
webroot/rsrc/css/phui/calendar/phui-calendar-day.css
··· 32 32 position: absolute; 33 33 top: 0; 34 34 bottom: 0; 35 + min-height: 30px; 35 36 } 36 37 37 38 .phui-calendar-day-event-link { 38 39 padding: 8px; 39 40 border: 1px solid {$blueborder}; 40 41 background-color: {$bluebackground}; 41 - margin: 4px; 42 + margin: 0 4px; 42 43 position: absolute; 43 44 left: 0; 44 45 right: 0;