Page MenuHomePhabricator

D21725.diff
No OneTemporary

D21725.diff

diff --git a/src/applications/people/controller/PhabricatorPeopleProfileViewController.php b/src/applications/people/controller/PhabricatorPeopleProfileViewController.php
--- a/src/applications/people/controller/PhabricatorPeopleProfileViewController.php
+++ b/src/applications/people/controller/PhabricatorPeopleProfileViewController.php
@@ -227,7 +227,7 @@
$day_view = id(new PHUICalendarWeekView())
->setViewer($viewer)
- ->setView('week')
+ ->setTipDirection('W')
->setEvents($event_views)
->setWeekLength(3)
->render();
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
@@ -1,12 +1,28 @@
<?php
final class PHUICalendarListView extends AphrontTagView {
-
+ private $epochStart;
+ private $epochEnd;
private $events = array();
private $blankState;
- private $view;
+ private $tipDirection = 'N';
+ private $pastDirection;
private $moreLink;
+ 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 setMoreLink($more_link) {
$this->moreLink = $more_link;
return $this;
@@ -16,15 +32,24 @@
return $this->moreLink;
}
- private function getView() {
- return $this->view;
+ public function setTipDirection($direction) {
+ $this->tipDirection = $direction;
+ return $this;
+ }
+
+ private function getTipDirection() {
+ return $this->tipDirection;
}
- public function setView($view) {
- $this->view = $view;
+ public function setPastDirection($direction) {
+ $this->pastDirection = $direction;
return $this;
}
+ private function getPastDirection() {
+ return $this->pastDirection;
+ }
+
public function addEvent(AphrontCalendarEventView $event) {
$this->events[] = $event;
return $this;
@@ -58,9 +83,10 @@
$singletons = array();
foreach ($this->events as $event) {
- $start_epoch = $event->getEpochStart();
-
- if ($event->getIsAllDay()) {
+ if ($event->getEpochStart() < $this->getEpochStart()) {
+ // The event starts on an earlier day, so hide the start time.
+ $timelabel = pht('');
+ } else if ($event->getIsAllDay()) {
$timelabel = pht('All Day');
} else {
$timelabel = phabricator_time(
@@ -68,7 +94,14 @@
$this->getUser());
}
- $icon_icon = $event->getIcon();
+ if ($event->getEpochStart() < $this->getEpochStart() &&
+ $this->getPastDirection() !== null) {
+ // Show that the event starts on an earlier day by pointing to the past.
+ $icon_icon = 'fa-arrow-circle-'.$this->getPastDirection();
+ } else {
+ $icon_icon = $event->getIcon();
+ }
+
$icon_color = $event->getIconColor();
$icon = id(new PHUIIconView())
@@ -98,24 +131,15 @@
$event_classes[] = 'event-cancelled';
}
- $tip = $event->getDateTimeSummary();
- if ($this->getView() == 'day') {
- $tip_align = 'E';
- } else if ($this->getView() == 'month') {
- $tip_align = 'N';
- } else {
- $tip_align = 'W';
- }
-
$content = javelin_tag(
'a',
array(
'href' => $event->getURI(),
'sigil' => 'has-tooltip',
'meta' => array(
- 'tip' => $tip,
+ 'tip' => $event->getDateTimeSummary(),
'size' => 200,
- 'align' => $tip_align,
+ 'align' => $this->getTipDirection(),
),
),
array(
diff --git a/src/view/phui/calendar/PHUICalendarMonthView.php b/src/view/phui/calendar/PHUICalendarMonthView.php
--- a/src/view/phui/calendar/PHUICalendarMonthView.php
+++ b/src/view/phui/calendar/PHUICalendarMonthView.php
@@ -93,7 +93,8 @@
$list = id(new PHUICalendarListView())
->setViewer($viewer)
- ->setView('month');
+ ->setEpochRange($day_start_epoch, $day_end_epoch)
+ ->setPastDirection('left');
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
--- a/src/view/phui/calendar/PHUICalendarWeekView.php
+++ b/src/view/phui/calendar/PHUICalendarWeekView.php
@@ -4,7 +4,7 @@
private $events;
private $dateTime;
private $weekLength = 7;
- private $view = 'day';
+ private $tipDirection = 'E';
public function setEvents($events) {
$this->events = $events;
@@ -28,13 +28,13 @@
return $this;
}
- public function setView($view) {
- $this->view = $view;
+ public function setTipDirection($direction) {
+ $this->tipDirection = $direction;
return $this;
}
- private function getView() {
- return $this->view;
+ private function getTipDirection() {
+ return $this->tipDirection;
}
public function render() {
@@ -61,6 +61,8 @@
}
$filled_boxes[] = $this->renderSidebarBox(
+ $box_start,
+ $box_end,
$box_events,
$day_box['title']);
}
@@ -68,13 +70,15 @@
return $filled_boxes;
}
- private function renderSidebarBox($events, $title) {
+ private function renderSidebarBox($epoch_start, $epoch_end, $events, $title) {
$widget = id(new PHUICalendarWidgetView())
->addClass('calendar-day-view-sidebar');
$list = id(new PHUICalendarListView())
->setUser($this->getViewer())
- ->setView($this->getView());
+ ->setEpochRange($epoch_start, $epoch_end)
+ ->setTipDirection($this->getTipDirection())
+ ->setPastDirection('up');
if (count($events) == 0) {
$list->showBlankState(true);

File Metadata

Mime Type
text/plain
Expires
Mon, Nov 25, 9:04 PM (21 h, 19 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6786975
Default Alt Text
D21725.diff (5 KB)

Event Timeline