diff --git a/resources/celerity/map.php b/resources/celerity/map.php --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -119,7 +119,7 @@ 'rsrc/css/layout/phabricator-hovercard-view.css' => '44394670', 'rsrc/css/layout/phabricator-side-menu-view.css' => 'c1db9e9c', 'rsrc/css/layout/phabricator-source-code-view.css' => '2ceee894', - 'rsrc/css/phui/calendar/phui-calendar-day.css' => 'c2eb34ce', + 'rsrc/css/phui/calendar/phui-calendar-day.css' => '75b8cc4a', 'rsrc/css/phui/calendar/phui-calendar-list.css' => 'c1d0ca59', 'rsrc/css/phui/calendar/phui-calendar-month.css' => 'a92e47d2', 'rsrc/css/phui/calendar/phui-calendar.css' => '8675968e', @@ -773,7 +773,7 @@ 'phui-box-css' => '7b3a2eed', 'phui-button-css' => 'de610129', 'phui-calendar-css' => '8675968e', - 'phui-calendar-day-css' => 'c2eb34ce', + 'phui-calendar-day-css' => '75b8cc4a', 'phui-calendar-list-css' => 'c1d0ca59', 'phui-calendar-month-css' => 'a92e47d2', 'phui-crumbs-view-css' => '594d719e', diff --git a/src/applications/calendar/query/PhabricatorCalendarEventSearchEngine.php b/src/applications/calendar/query/PhabricatorCalendarEventSearchEngine.php --- a/src/applications/calendar/query/PhabricatorCalendarEventSearchEngine.php +++ b/src/applications/calendar/query/PhabricatorCalendarEventSearchEngine.php @@ -389,7 +389,7 @@ $phids = mpull($statuses, 'getUserPHID'); foreach ($statuses as $status) { - $event = new AphrontCalendarDayEventView(); + $event = new AphrontCalendarEventView(); $event->setEventID($status->getID()); $event->setEpochRange($status->getDateFrom(), $status->getDateTo()); diff --git a/src/applications/calendar/view/AphrontCalendarDayEventView.php b/src/applications/calendar/view/AphrontCalendarDayEventView.php deleted file mode 100644 --- a/src/applications/calendar/view/AphrontCalendarDayEventView.php +++ /dev/null @@ -1,58 +0,0 @@ -eventID = $event_id; - return $this; - } - - public function getEventID() { - return $this->eventID; - } - - public function setName($name) { - $this->name = $name; - return $this; - } - - public function getName() { - return $this->name; - } - - public function setURI($uri) { - $this->uri = $uri; - return $this; - } - - public function getURI() { - return $this->uri; - } - - public function setEpochRange($start, $end) { - $this->epochStart = $start; - $this->epochEnd = $end; - return $this; - } - - public function getEpochStart() { - return $this->epochStart; - } - - public function getEpochEnd() { - return $this->epochEnd; - } - - public function render() { - $box = new PHUIObjectBoxView(); - $box->setHeaderText($this->name); - return $box; - - } -} diff --git a/src/applications/calendar/view/AphrontCalendarEventView.php b/src/applications/calendar/view/AphrontCalendarEventView.php --- a/src/applications/calendar/view/AphrontCalendarEventView.php +++ b/src/applications/calendar/view/AphrontCalendarEventView.php @@ -9,6 +9,16 @@ private $description; private $eventID; private $color; + private $uri; + + public function setURI($uri) { + $this->uri = $uri; + return $this; + } + + public function getURI() { + return $this->uri; + } public function setEventID($event_id) { $this->eventID = $event_id; diff --git a/src/view/phui/calendar/PHUICalendarDayView.php b/src/view/phui/calendar/PHUICalendarDayView.php --- a/src/view/phui/calendar/PHUICalendarDayView.php +++ b/src/view/phui/calendar/PHUICalendarDayView.php @@ -8,7 +8,7 @@ private $browseURI; private $events = array(); - public function addEvent(AphrontCalendarDayEventView $event) { + public function addEvent(AphrontCalendarEventView $event) { $this->events[] = $event; return $this; } @@ -121,41 +121,21 @@ $table_box = id(new PHUIObjectBoxView()) ->setHeader($header) - ->appendChild($table); - - $column1 = phutil_tag( - 'div', - array( - 'class' => 'pm', - ), - $sidebar); - - $column2 = phutil_tag( - 'div', - array( - 'class' => 'pm', - ), - $table_box); + ->appendChild($table) + ->setFlush(true); $layout = id(new AphrontMultiColumnView()) - ->addColumn($column1, 'third') - ->addColumn($column2, 'thirds') + ->addColumn($sidebar, 'third') + ->addColumn($table_box, 'thirds') ->setFluidLayout(true) ->setGutter(AphrontMultiColumnView::GUTTER_MEDIUM); - $wrap = phutil_tag( + return phutil_tag( 'div', array( 'class' => 'ml', ), $layout); - - return phutil_tag( - 'div', - array(), - array( - $wrap, - )); } private function renderSidebar() { @@ -163,11 +143,10 @@ $week_of_boxes = $this->getWeekOfBoxes(); $filled_boxes = array(); - foreach ($week_of_boxes as $box) { - $start = $box['start']; + foreach ($week_of_boxes as $weekly_box) { + $start = $weekly_box['start']; $end = id(clone $start)->modify('+1 day'); - $box = $box['box']; $box_events = array(); foreach ($this->events as $event) { @@ -176,65 +155,32 @@ $box_events[] = $event; } } - $filled_boxes[] = $this->renderSidebarBox($box_events, $box); + $filled_boxes[] = $this->renderSidebarBox( + $box_events, + $weekly_box['title']); } return $filled_boxes; } - private function renderSidebarBox($events, $box) { - $user = $this->user; - $rows = array(); - - foreach ($events as $key => $event) { - $uri = $event->getURI(); - $name = $event->getName(); - $time = id(AphrontFormDateControlValue::newFromEpoch( - $user, - $event->getEpochStart())) - ->getValueTime(); - - $name = phutil_tag( - 'a', - array( - 'href' => $uri, - ), - $name); - - $name = phutil_tag( - 'td', - array( - 'class' => 'calendar-day-sidebar-column-name', - ), - $name); + private function renderSidebarBox($events, $title) { + $widget = new PHUICalendarWidgetView(); - $time = phutil_tag( - 'td', - array( - 'class' => 'calendar-day-sidebar-column-time', - ), - $time); + $list = id(new PHUICalendarListView()) + ->setUser($this->user); - $rows[] = phutil_tag( - 'tr', - array( - 'class' => 'calendar-day-sidebar-row', - ), - array( - $name, - $time, - )); + if (count($events) == 0) { + $list->showBlankState(true); + } else { + foreach ($events as $event) { + $list->addEvent($event); + } } - $table = phutil_tag( - 'table', - array( - 'class' => 'calendar-day-sidebar-today-table', - ), - $rows); - - $box->appendChild($table); - return $box; + $widget + ->setCalendarList($list) + ->setHeader($title); + return $widget; } private function getWeekOfBoxes() { @@ -259,7 +205,7 @@ } $sidebar_day_boxes[] = array( - 'box' => id(new PHUIObjectBoxView())->setHeaderText($title), + 'title' => $title, 'start' => clone $box_start_time, ); @@ -339,7 +285,7 @@ } private function drawEvent( - AphrontCalendarDayEventView $event, + AphrontCalendarEventView $event, $offset, $width, $top, diff --git a/src/view/phui/calendar/PHUICalendarListView.php b/src/view/phui/calendar/PHUICalendarListView.php --- a/src/view/phui/calendar/PHUICalendarListView.php +++ b/src/view/phui/calendar/PHUICalendarListView.php @@ -123,7 +123,7 @@ 'size' => 200, ), ), - $description); + $event->getName()); return $anchor; } diff --git a/webroot/rsrc/css/phui/calendar/phui-calendar-day.css b/webroot/rsrc/css/phui/calendar/phui-calendar-day.css --- a/webroot/rsrc/css/phui/calendar/phui-calendar-day.css +++ b/webroot/rsrc/css/phui/calendar/phui-calendar-day.css @@ -7,29 +7,6 @@ width: 100%; } -.calendar-day-sidebar-today-table { - width: 100%; - margin: 8px 0; -} - -.calendar-day-sidebar-column-name { - text-align: left; - color: {$bluetext}; - width: 60%; - padding: 4px 16px; -} - -.calendar-day-sidebar-column-name a { - color: {$bluetext}; -} - -.calendar-day-sidebar-column-time { - color: {$bluetext}; - text-align: right; - width: 40%; - padding: 4px 16px; -} - .phui-calendar-day-hour { width: 60px; color: {$lightgreytext};