@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.

Refactoring to use `PHUICalendarListView` instead of boxes

Summary: Ref T4393, Refactoring to use `PHUICalendarListView` instead of boxes

Test Plan: See new sidebar

Reviewers: chad, #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T4393

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

+41 -166
+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' => 'c2eb34ce', 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', ··· 773 773 'phui-box-css' => '7b3a2eed', 774 774 'phui-button-css' => 'de610129', 775 775 'phui-calendar-css' => '8675968e', 776 - 'phui-calendar-day-css' => 'c2eb34ce', 776 + 'phui-calendar-day-css' => '75b8cc4a', 777 777 'phui-calendar-list-css' => 'c1d0ca59', 778 778 'phui-calendar-month-css' => 'a92e47d2', 779 779 'phui-crumbs-view-css' => '594d719e',
+1 -1
src/applications/calendar/query/PhabricatorCalendarEventSearchEngine.php
··· 389 389 $phids = mpull($statuses, 'getUserPHID'); 390 390 391 391 foreach ($statuses as $status) { 392 - $event = new AphrontCalendarDayEventView(); 392 + $event = new AphrontCalendarEventView(); 393 393 $event->setEventID($status->getID()); 394 394 $event->setEpochRange($status->getDateFrom(), $status->getDateTo()); 395 395
-58
src/applications/calendar/view/AphrontCalendarDayEventView.php
··· 1 - <?php 2 - 3 - final class AphrontCalendarDayEventView extends AphrontView { 4 - 5 - private $eventID; 6 - private $epochStart; 7 - private $epochEnd; 8 - private $name; 9 - private $uri; 10 - 11 - public function setEventID($event_id) { 12 - $this->eventID = $event_id; 13 - return $this; 14 - } 15 - 16 - public function getEventID() { 17 - return $this->eventID; 18 - } 19 - 20 - public function setName($name) { 21 - $this->name = $name; 22 - return $this; 23 - } 24 - 25 - public function getName() { 26 - return $this->name; 27 - } 28 - 29 - public function setURI($uri) { 30 - $this->uri = $uri; 31 - return $this; 32 - } 33 - 34 - public function getURI() { 35 - return $this->uri; 36 - } 37 - 38 - public function setEpochRange($start, $end) { 39 - $this->epochStart = $start; 40 - $this->epochEnd = $end; 41 - return $this; 42 - } 43 - 44 - public function getEpochStart() { 45 - return $this->epochStart; 46 - } 47 - 48 - public function getEpochEnd() { 49 - return $this->epochEnd; 50 - } 51 - 52 - public function render() { 53 - $box = new PHUIObjectBoxView(); 54 - $box->setHeaderText($this->name); 55 - return $box; 56 - 57 - } 58 - }
+10
src/applications/calendar/view/AphrontCalendarEventView.php
··· 9 9 private $description; 10 10 private $eventID; 11 11 private $color; 12 + private $uri; 13 + 14 + public function setURI($uri) { 15 + $this->uri = $uri; 16 + return $this; 17 + } 18 + 19 + public function getURI() { 20 + return $this->uri; 21 + } 12 22 13 23 public function setEventID($event_id) { 14 24 $this->eventID = $event_id;
+27 -81
src/view/phui/calendar/PHUICalendarDayView.php
··· 8 8 private $browseURI; 9 9 private $events = array(); 10 10 11 - public function addEvent(AphrontCalendarDayEventView $event) { 11 + public function addEvent(AphrontCalendarEventView $event) { 12 12 $this->events[] = $event; 13 13 return $this; 14 14 } ··· 121 121 122 122 $table_box = id(new PHUIObjectBoxView()) 123 123 ->setHeader($header) 124 - ->appendChild($table); 125 - 126 - $column1 = phutil_tag( 127 - 'div', 128 - array( 129 - 'class' => 'pm', 130 - ), 131 - $sidebar); 132 - 133 - $column2 = phutil_tag( 134 - 'div', 135 - array( 136 - 'class' => 'pm', 137 - ), 138 - $table_box); 124 + ->appendChild($table) 125 + ->setFlush(true); 139 126 140 127 $layout = id(new AphrontMultiColumnView()) 141 - ->addColumn($column1, 'third') 142 - ->addColumn($column2, 'thirds') 128 + ->addColumn($sidebar, 'third') 129 + ->addColumn($table_box, 'thirds') 143 130 ->setFluidLayout(true) 144 131 ->setGutter(AphrontMultiColumnView::GUTTER_MEDIUM); 145 132 146 - $wrap = phutil_tag( 133 + return phutil_tag( 147 134 'div', 148 135 array( 149 136 'class' => 'ml', 150 137 ), 151 138 $layout); 152 - 153 - return phutil_tag( 154 - 'div', 155 - array(), 156 - array( 157 - $wrap, 158 - )); 159 139 } 160 140 161 141 private function renderSidebar() { ··· 163 143 $week_of_boxes = $this->getWeekOfBoxes(); 164 144 $filled_boxes = array(); 165 145 166 - foreach ($week_of_boxes as $box) { 167 - $start = $box['start']; 146 + foreach ($week_of_boxes as $weekly_box) { 147 + $start = $weekly_box['start']; 168 148 $end = id(clone $start)->modify('+1 day'); 169 149 170 - $box = $box['box']; 171 150 $box_events = array(); 172 151 173 152 foreach ($this->events as $event) { ··· 176 155 $box_events[] = $event; 177 156 } 178 157 } 179 - $filled_boxes[] = $this->renderSidebarBox($box_events, $box); 158 + $filled_boxes[] = $this->renderSidebarBox( 159 + $box_events, 160 + $weekly_box['title']); 180 161 } 181 162 182 163 return $filled_boxes; 183 164 } 184 165 185 - private function renderSidebarBox($events, $box) { 186 - $user = $this->user; 187 - $rows = array(); 188 - 189 - foreach ($events as $key => $event) { 190 - $uri = $event->getURI(); 191 - $name = $event->getName(); 192 - $time = id(AphrontFormDateControlValue::newFromEpoch( 193 - $user, 194 - $event->getEpochStart())) 195 - ->getValueTime(); 196 - 197 - $name = phutil_tag( 198 - 'a', 199 - array( 200 - 'href' => $uri, 201 - ), 202 - $name); 203 - 204 - $name = phutil_tag( 205 - 'td', 206 - array( 207 - 'class' => 'calendar-day-sidebar-column-name', 208 - ), 209 - $name); 166 + private function renderSidebarBox($events, $title) { 167 + $widget = new PHUICalendarWidgetView(); 210 168 211 - $time = phutil_tag( 212 - 'td', 213 - array( 214 - 'class' => 'calendar-day-sidebar-column-time', 215 - ), 216 - $time); 169 + $list = id(new PHUICalendarListView()) 170 + ->setUser($this->user); 217 171 218 - $rows[] = phutil_tag( 219 - 'tr', 220 - array( 221 - 'class' => 'calendar-day-sidebar-row', 222 - ), 223 - array( 224 - $name, 225 - $time, 226 - )); 172 + if (count($events) == 0) { 173 + $list->showBlankState(true); 174 + } else { 175 + foreach ($events as $event) { 176 + $list->addEvent($event); 177 + } 227 178 } 228 179 229 - $table = phutil_tag( 230 - 'table', 231 - array( 232 - 'class' => 'calendar-day-sidebar-today-table', 233 - ), 234 - $rows); 235 - 236 - $box->appendChild($table); 237 - return $box; 180 + $widget 181 + ->setCalendarList($list) 182 + ->setHeader($title); 183 + return $widget; 238 184 } 239 185 240 186 private function getWeekOfBoxes() { ··· 259 205 } 260 206 261 207 $sidebar_day_boxes[] = array( 262 - 'box' => id(new PHUIObjectBoxView())->setHeaderText($title), 208 + 'title' => $title, 263 209 'start' => clone $box_start_time, 264 210 ); 265 211 ··· 339 285 } 340 286 341 287 private function drawEvent( 342 - AphrontCalendarDayEventView $event, 288 + AphrontCalendarEventView $event, 343 289 $offset, 344 290 $width, 345 291 $top,
+1 -1
src/view/phui/calendar/PHUICalendarListView.php
··· 123 123 'size' => 200, 124 124 ), 125 125 ), 126 - $description); 126 + $event->getName()); 127 127 128 128 return $anchor; 129 129 }
-23
webroot/rsrc/css/phui/calendar/phui-calendar-day.css
··· 7 7 width: 100%; 8 8 } 9 9 10 - .calendar-day-sidebar-today-table { 11 - width: 100%; 12 - margin: 8px 0; 13 - } 14 - 15 - .calendar-day-sidebar-column-name { 16 - text-align: left; 17 - color: {$bluetext}; 18 - width: 60%; 19 - padding: 4px 16px; 20 - } 21 - 22 - .calendar-day-sidebar-column-name a { 23 - color: {$bluetext}; 24 - } 25 - 26 - .calendar-day-sidebar-column-time { 27 - color: {$bluetext}; 28 - text-align: right; 29 - width: 40%; 30 - padding: 4px 16px; 31 - } 32 - 33 10 .phui-calendar-day-hour { 34 11 width: 60px; 35 12 color: {$lightgreytext};