From 359e8d4aa59e5940235e9b321352f0ef5e1f84b1 Mon Sep 17 00:00:00 2001 From: lkassianik Date: Mon, 23 May 2016 10:24:02 -0700 Subject: [PATCH] Hover hint on calendar list items should appear on the most convenient side of the item Summary: Hover hint on calendar list items should be to the right in day view, left in profile view, on top in month view Test Plan: Open profile view, calendar items should have a left hover. Open day view, calendar items should have a right hover. Open month view, calendar items should have top hover. Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: Korvin Maniphest Tasks: T9606 Differential Revision: https://secure.phabricator.com/D15964 --- .../PhabricatorPeopleProfileViewController.php | 1 + src/view/phui/calendar/PHUICalendarListView.php | 8 +++++++- src/view/phui/calendar/PHUICalendarMonthView.php | 5 +++-- src/view/phui/calendar/PHUICalendarWeekView.php | 12 +++++++++++- 4 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/applications/people/controller/PhabricatorPeopleProfileViewController.php b/src/applications/people/controller/PhabricatorPeopleProfileViewController.php index 170eabcad0..323d5f66af 100644 --- a/src/applications/people/controller/PhabricatorPeopleProfileViewController.php +++ b/src/applications/people/controller/PhabricatorPeopleProfileViewController.php @@ -223,6 +223,7 @@ final class PhabricatorPeopleProfileViewController $events = msort($events, 'getEpochStart'); $day_view = id(new PHUICalendarWeekView()) ->setViewer($viewer) + ->setView('week') ->setEvents($events) ->setWeekLength(3) ->render(); diff --git a/src/view/phui/calendar/PHUICalendarListView.php b/src/view/phui/calendar/PHUICalendarListView.php index 9f9bc86a80..fc2929adae 100644 --- a/src/view/phui/calendar/PHUICalendarListView.php +++ b/src/view/phui/calendar/PHUICalendarListView.php @@ -85,7 +85,13 @@ final class PHUICalendarListView extends AphrontTagView { } $tip = $this->getEventTooltip($event); - $tip_align = ($this->getView() == 'day') ? 'E' : 'N'; + if ($this->getView() == 'day') { + $tip_align = 'E'; + } else if ($this->getView() == 'month') { + $tip_align = 'N'; + } else { + $tip_align = 'W'; + } $content = javelin_tag( 'a', array( diff --git a/src/view/phui/calendar/PHUICalendarMonthView.php b/src/view/phui/calendar/PHUICalendarMonthView.php index d40736494e..396947cdbe 100644 --- a/src/view/phui/calendar/PHUICalendarMonthView.php +++ b/src/view/phui/calendar/PHUICalendarMonthView.php @@ -90,8 +90,9 @@ final class PHUICalendarMonthView extends AphrontView { $max_daily = 15; $counter = 0; - $list = new PHUICalendarListView(); - $list->setViewer($viewer); + $list = id(new PHUICalendarListView()) + ->setViewer($viewer) + ->setView('month'); foreach ($all_day_events as $item) { if ($counter <= $max_daily) { $list->addEvent($item); diff --git a/src/view/phui/calendar/PHUICalendarWeekView.php b/src/view/phui/calendar/PHUICalendarWeekView.php index bcfc3666c1..6237e5b569 100644 --- a/src/view/phui/calendar/PHUICalendarWeekView.php +++ b/src/view/phui/calendar/PHUICalendarWeekView.php @@ -4,6 +4,7 @@ final class PHUICalendarWeekView extends AphrontView { private $events; private $dateTime; private $weekLength = 7; + private $view = 'day'; public function setEvents($events) { $this->events = $events; @@ -27,6 +28,15 @@ final class PHUICalendarWeekView extends AphrontView { return $this; } + public function setView($view) { + $this->view = $view; + return $this; + } + + private function getView() { + return $this->view; + } + public function render() { $this->events = msort($this->events, 'getEpochStart'); $week_of_boxes = $this->getWeekOfBoxes(); @@ -64,7 +74,7 @@ final class PHUICalendarWeekView extends AphrontView { $list = id(new PHUICalendarListView()) ->setUser($this->getViewer()) - ->setView('day'); + ->setView($this->getView()); if (count($events) == 0) { $list->showBlankState(true);