Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14042315
D16880.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D16880.diff
View Options
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
@@ -379,6 +379,7 @@
->setIsAllDay($event->getIsAllDay())
->setIcon($event->getDisplayIcon($viewer))
->setViewerIsInvited($is_invited)
+ ->setDatetimeSummary($event->renderEventDate($viewer, true))
->setIconColor($event->getDisplayIconColor($viewer));
$month_view->addEvent($event_view);
@@ -447,6 +448,7 @@
->setIconColor($status_color)
->setName($event->getName())
->setURI($event->getURI())
+ ->setDatetimeSummary($event->renderEventDate($viewer, true))
->setIsCancelled($event->getIsCancelled());
$day_view->addEvent($event_view);
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
@@ -15,6 +15,7 @@
private $iconColor;
private $canEdit;
private $isCancelled;
+ private $datetimeSummary;
public function setIconColor($icon_color) {
$this->iconColor = $icon_color;
@@ -135,6 +136,15 @@
return false;
}
+ public function setDatetimeSummary($datetime_summary) {
+ $this->datetimeSummary = $datetime_summary;
+ return $this;
+ }
+
+ public function getDatetimeSummary() {
+ return $this->datetimeSummary;
+ }
+
public function render() {
throw new Exception(pht('Events are only rendered indirectly.'));
}
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
@@ -217,6 +217,7 @@
->setIcon($event->getIcon())
->setViewerIsInvited($viewer_is_invited)
->setName($event->getName())
+ ->setDatetimeSummary($event->renderEventDate($viewer, true))
->setURI($event->getURI());
$event_views[] = $event_view;
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
@@ -54,6 +54,8 @@
return '';
}
+ Javelin::initBehavior('phabricator-tooltips');
+
$singletons = array();
$allday = false;
foreach ($this->events as $event) {
@@ -97,7 +99,7 @@
$event_classes[] = 'event-cancelled';
}
- $tip = $this->getEventTooltip($event);
+ $tip = $event->getDateTimeSummary();
if ($this->getView() == 'day') {
$tip_align = 'E';
} else if ($this->getView() == 'month') {
@@ -183,52 +185,6 @@
$event->getName());
}
- private function getEventTooltip(AphrontCalendarEventView $event) {
- $viewer = $this->getViewer();
- $time_key = PhabricatorTimeFormatSetting::SETTINGKEY;
- $time_pref = $viewer->getUserSetting($time_key);
-
- Javelin::initBehavior('phabricator-tooltips');
-
- $start = id(AphrontFormDateControlValue::newFromEpoch(
- $viewer,
- $event->getEpochStart()));
-
- $end = id(AphrontFormDateControlValue::newFromEpoch(
- $viewer,
- $event->getEpochEnd()));
-
- $end_date = $end->getDateTime();
- $end_date = $end_date->modify('-1 second');
-
- $start_date = $start->getDateTime()->format('m d Y');
- $end_date = $end_date->format('m d Y');
-
- if ($event->getIsAllDay()) {
- if ($start_date == $end_date) {
- $tip = pht('All day');
- } else {
- $tip = pht(
- 'All day, %s - %s',
- $start->getValueAsFormat('M j, Y'),
- $end->getValueAsFormat('M j, Y'));
- }
- } else {
- if ($start->getValueDate() == $end->getValueDate()) {
- $tip = pht(
- '%s - %s',
- $start->getValueAsFormat($time_pref),
- $end->getValueAsFormat($time_pref));
- } else {
- $tip = pht(
- '%s - %s',
- $start->getValueAsFormat('M j, Y, '.$time_pref),
- $end->getValueAsFormat('M j, Y, '.$time_pref));
- }
- }
- return $tip;
- }
-
public function getIsViewerInvitedOnList() {
foreach ($this->events as $event) {
if ($event->getViewerIsInvited()) {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Nov 13, 2:27 AM (6 d, 1 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6719078
Default Alt Text
D16880.diff (4 KB)
Attached To
Mode
D16880: Use the same date rendering display logic for both tooltips and subheaders
Attached
Detach File
Event Timeline
Log In to Comment