diff --git a/resources/celerity/map.php b/resources/celerity/map.php --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -122,8 +122,8 @@ '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' => 'c0cf782a', - 'rsrc/css/phui/calendar/phui-calendar-list.css' => '857a0d83', - 'rsrc/css/phui/calendar/phui-calendar-month.css' => '1d0e1e9b', + 'rsrc/css/phui/calendar/phui-calendar-list.css' => 'c1c7f338', + 'rsrc/css/phui/calendar/phui-calendar-month.css' => '94b1750a', 'rsrc/css/phui/calendar/phui-calendar.css' => 'ccabe893', 'rsrc/css/phui/phui-action-header-view.css' => '89c497e7', 'rsrc/css/phui/phui-action-list.css' => '4f4d09f2', @@ -764,8 +764,8 @@ 'phui-button-css' => 'de610129', 'phui-calendar-css' => 'ccabe893', 'phui-calendar-day-css' => 'c0cf782a', - 'phui-calendar-list-css' => '857a0d83', - 'phui-calendar-month-css' => '1d0e1e9b', + 'phui-calendar-list-css' => 'c1c7f338', + 'phui-calendar-month-css' => '94b1750a', 'phui-crumbs-view-css' => '594d719e', 'phui-document-view-css' => '94d5dcd8', 'phui-feed-story-css' => 'c9f3a0b5', 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 @@ -364,6 +364,7 @@ $event = new AphrontCalendarEventView(); $event->setEpochRange($status->getDateFrom(), $status->getDateTo()); $event->setIsAllDay($status->getIsAllDay()); + $event->setIcon($status->getIcon()); $name_text = $handles[$status->getUserPHID()]->getName(); $status_text = $status->getName(); @@ -411,6 +412,7 @@ $event->setEventID($status->getID()); $event->setEpochRange($status->getDateFrom(), $status->getDateTo()); $event->setIsAllDay($status->getIsAllDay()); + $event->setIcon($status->getIcon()); $event->setViewerIsInvited($viewer_is_invited); $event->setName($status->getName()); 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 @@ -11,6 +11,7 @@ private $viewerIsInvited; private $uri; private $isAllDay; + private $icon; public function setURI($uri) { $this->uri = $uri; @@ -87,6 +88,15 @@ return $this->isAllDay; } + public function setIcon($icon) { + $this->icon = $icon; + return $this; + } + + public function getIcon() { + return $this->icon; + } + public function getMultiDay() { $nextday = strtotime('12:00 AM Tomorrow', $this->getEpochStart()); 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 @@ -276,7 +276,8 @@ ->addClass('calendar-day-view-sidebar'); $list = id(new PHUICalendarListView()) - ->setUser($this->user); + ->setUser($this->user) + ->setView('day'); if (count($events) == 0) { $list->showBlankState(true); 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 @@ -4,6 +4,16 @@ private $events = array(); private $blankState; + private $view; + + private function getView() { + return $this->view; + } + + public function setView($view) { + $this->view = $view; + return $this; + } public function addEvent(AphrontCalendarEventView $event) { $this->events[] = $event; @@ -37,26 +47,28 @@ if ($event->getIsAllDay()) { $timelabel = pht('All Day'); - $dot = null; } else { $timelabel = phabricator_time( $event->getEpochStart(), $this->getUser()); + } - $dot = phutil_tag( - 'span', - array( - 'class' => 'phui-calendar-list-dot', - ), - ''); + if ($event->getViewerIsInvited()) { + $icon_color = 'green'; + } else { + $icon_color = null; } + $dot = id(new PHUIIconView()) + ->setIconFont($event->getIcon(), $icon_color) + ->addClass('phui-calendar-list-item-icon'); + $title = phutil_tag( 'span', array( 'class' => 'phui-calendar-list-title', ), - $this->renderEventLink($event, $allday)); + $this->getEventTitle($event, $allday)); $time = phutil_tag( 'span', array( @@ -72,10 +84,18 @@ $class = $class.' all-day'; } - $content = phutil_tag( + $tip = $this->getEventTooltip($event); + $tip_align = ($this->getView() == 'day') ? 'E' : 'N'; + $content = javelin_tag( 'a', array( 'href' => '/E'.$event->getEventID(), + 'sigil' => 'has-tooltip', + 'meta' => array( + 'tip' => $tip, + 'size' => 200, + 'align' => $tip_align, + ), ), array( $dot, @@ -110,8 +130,17 @@ return $list; } - private function renderEventLink($event) { + private function getEventTitle($event) { + $class = 'phui-calendar-item'; + return phutil_tag( + 'span', + array( + 'class' => $class, + ), + $event->getName()); + } + private function getEventTooltip(AphrontCalendarEventView $event) { Javelin::initBehavior('phabricator-tooltips'); $start = id(AphrontFormDateControlValue::newFromEpoch( @@ -145,27 +174,7 @@ $end->getValueAsFormat('M j, Y, g:i A')); } } - - $description = $event->getDescription(); - if (strlen($description) == 0) { - $description = pht('(%s)', $event->getName()); - } - - $class = 'phui-calendar-item'; - - $anchor = javelin_tag( - 'span', - array( - 'sigil' => 'has-tooltip', - 'class' => $class, - 'meta' => array( - 'tip' => $tip, - 'size' => 200, - ), - ), - $event->getName()); - - return $anchor; + return $tip; } public function getIsViewerInvitedOnList() { diff --git a/webroot/rsrc/css/phui/calendar/phui-calendar-list.css b/webroot/rsrc/css/phui/calendar/phui-calendar-list.css --- a/webroot/rsrc/css/phui/calendar/phui-calendar-list.css +++ b/webroot/rsrc/css/phui/calendar/phui-calendar-list.css @@ -29,25 +29,30 @@ .phui-calendar-list-item { position: relative; + line-height: 18px; + height: 18px; } -.phui-calendar-list-dot { - position: relative; - display: inline-block; - width: 5px; - height: 5px; - margin-right: 6px; - top: -5px; - border-radius: 10px; - border: 1px solid transparent; +.phui-calendar-list-item a { + display: block; + width: auto; + min-height: 18px; +} + +.phui-calendar-list-item-icon { + position: absolute; + left: 0; + top: 3px; } .phui-calendar-list-title { width: 200px; - display: inline-block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; + position: absolute; + left: 20px; + top: 0; } .phui-calendar-viewer-invited .phui-calendar-list-title { @@ -61,6 +66,7 @@ right: 0; color: {$lightgreytext}; text-align: right; + line-height: 20px; } .phui-calendar-list-item-empty { diff --git a/webroot/rsrc/css/phui/calendar/phui-calendar-month.css b/webroot/rsrc/css/phui/calendar/phui-calendar-month.css --- a/webroot/rsrc/css/phui/calendar/phui-calendar-month.css +++ b/webroot/rsrc/css/phui/calendar/phui-calendar-month.css @@ -180,6 +180,7 @@ display: block; overflow: hidden; position: relative; + height: 18px; } .phui-calendar-view li.phui-calendar-list-item { @@ -187,40 +188,27 @@ width: auto; } -.phui-calendar-view .phui-calendar-list-dot { - position: relative; +.phui-calendar-list-item-icon { display: block; - float: left; - width: 3px; - height: 3px; - margin-right: 4px; - border-radius: 10px; - top: 5px; - left: 0; - display: none; + left: 0px; } .phui-calendar-view li.phui-calendar-list-item .phui-calendar-list-title { width: auto; position: absolute; - right: 0; - left: 60px; + left: 20px; + right: 60px; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; } -li.all-day { - line-height: 18px; -} - .phui-calendar-view li.phui-calendar-list-item .phui-calendar-list-time { - position: relative; - display: inline-block; - float: left; + position: absolute; + top: 0; + right: 0px; padding: 0; - line-height: 18px; width: 60px; color: {$lightgreytext}; - text-align: left; + text-align: right; }