mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-25 14:08:19 +01:00
Don't mix different users on the same line in Calendar
Summary: The current state is very confusing: {F11734, size=full} Test Plan: Display calendar for user with two different events in the same week. Reviewers: epriestley, btrahan Reviewed By: epriestley CC: aran, Koolvin Differential Revision: https://secure.phabricator.com/D2522
This commit is contained in:
parent
77f546c572
commit
bb7285ab46
5 changed files with 41 additions and 12 deletions
|
@ -389,7 +389,7 @@ celerity_register_resource_map(array(
|
||||||
),
|
),
|
||||||
'aphront-calendar-view-css' =>
|
'aphront-calendar-view-css' =>
|
||||||
array(
|
array(
|
||||||
'uri' => '/res/4fd79240/rsrc/css/aphront/calendar-view.css',
|
'uri' => '/res/b200376d/rsrc/css/aphront/calendar-view.css',
|
||||||
'type' => 'css',
|
'type' => 'css',
|
||||||
'requires' =>
|
'requires' =>
|
||||||
array(
|
array(
|
||||||
|
|
|
@ -51,6 +51,7 @@ final class PhabricatorCalendarBrowseController
|
||||||
|
|
||||||
$name_text = $handles[$status->getUserPHID()]->getName();
|
$name_text = $handles[$status->getUserPHID()]->getName();
|
||||||
$status_text = $status->getTextStatus();
|
$status_text = $status->getTextStatus();
|
||||||
|
$event->setUserPHID($status->getUserPHID());
|
||||||
$event->setName("{$name_text} ({$status_text})");
|
$event->setName("{$name_text} ({$status_text})");
|
||||||
$event->setDescription($status->getStatusDescription($user));
|
$event->setDescription($status->getStatusDescription($user));
|
||||||
$month_view->addEvent($event);
|
$month_view->addEvent($event);
|
||||||
|
|
|
@ -18,11 +18,21 @@
|
||||||
|
|
||||||
final class AphrontCalendarEventView extends AphrontView {
|
final class AphrontCalendarEventView extends AphrontView {
|
||||||
|
|
||||||
|
private $userPHID;
|
||||||
private $name;
|
private $name;
|
||||||
private $epochStart;
|
private $epochStart;
|
||||||
private $epochEnd;
|
private $epochEnd;
|
||||||
private $description;
|
private $description;
|
||||||
|
|
||||||
|
public function setUserPHID($user_phid) {
|
||||||
|
$this->userPHID = $user_phid;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getUserPHID() {
|
||||||
|
return $this->userPHID;
|
||||||
|
}
|
||||||
|
|
||||||
public function setName($name) {
|
public function setName($name) {
|
||||||
$this->name = $name;
|
$this->name = $name;
|
||||||
return $this;
|
return $this;
|
||||||
|
|
|
@ -69,6 +69,8 @@ final class AphrontCalendarMonthView extends AphrontView {
|
||||||
$markup[] = $empty_box;
|
$markup[] = $empty_box;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$show_events = array();
|
||||||
|
|
||||||
foreach ($days as $day) {
|
foreach ($days as $day) {
|
||||||
$holiday = idx($this->holidays, $day->format('Y-m-d'));
|
$holiday = idx($this->holidays, $day->format('Y-m-d'));
|
||||||
$class = 'aphront-calendar-day';
|
$class = 'aphront-calendar-day';
|
||||||
|
@ -80,18 +82,27 @@ final class AphrontCalendarMonthView extends AphrontView {
|
||||||
$day->setTime(0, 0, 0);
|
$day->setTime(0, 0, 0);
|
||||||
$epoch_start = $day->format('U');
|
$epoch_start = $day->format('U');
|
||||||
|
|
||||||
$day->setTime(23, 59, 59);
|
$day->setTime(24, 0, 0);
|
||||||
$epoch_end = $day->format('U');
|
$epoch_end = $day->format('U');
|
||||||
|
|
||||||
$show_events = array();
|
if ($weekday == 0) {
|
||||||
|
$show_events = array();
|
||||||
|
} else {
|
||||||
|
$show_events = array_fill_keys(
|
||||||
|
array_keys($show_events),
|
||||||
|
'<div class="aphront-calendar-event aphront-calendar-event-empty">'.
|
||||||
|
' '.
|
||||||
|
'</div>');
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($events as $event) {
|
foreach ($events as $event) {
|
||||||
if ($event->getEpochStart() > $epoch_end) {
|
if ($event->getEpochStart() >= $epoch_end) {
|
||||||
// This list is sorted, so we can stop looking.
|
// This list is sorted, so we can stop looking.
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if ($event->getEpochStart() <= $epoch_end &&
|
if ($event->getEpochStart() < $epoch_end &&
|
||||||
$event->getEpochEnd() >= $epoch_start) {
|
$event->getEpochEnd() > $epoch_start) {
|
||||||
$show_events[] = $this->renderEvent(
|
$show_events[$event->getUserPHID()] = $this->renderEvent(
|
||||||
$event,
|
$event,
|
||||||
$day,
|
$day,
|
||||||
$epoch_start,
|
$epoch_start,
|
||||||
|
@ -101,18 +112,19 @@ final class AphrontCalendarMonthView extends AphrontView {
|
||||||
|
|
||||||
$holiday_markup = null;
|
$holiday_markup = null;
|
||||||
if ($holiday) {
|
if ($holiday) {
|
||||||
|
$name = phutil_escape_html($holiday->getName());
|
||||||
$holiday_markup =
|
$holiday_markup =
|
||||||
'<div class="aphront-calendar-holiday">'.
|
'<div class="aphront-calendar-holiday" title="'.$name.'">'.
|
||||||
phutil_escape_html($holiday->getName()).
|
$name.
|
||||||
'</div>';
|
'</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$markup[] =
|
$markup[] =
|
||||||
'<div class="'.$class.'">'.
|
'<div class="'.$class.'">'.
|
||||||
$holiday_markup.
|
|
||||||
'<div class="aphront-calendar-date-number">'.
|
'<div class="aphront-calendar-date-number">'.
|
||||||
$day->format('j').
|
$day->format('j').
|
||||||
'</div>'.
|
'</div>'.
|
||||||
|
$holiday_markup.
|
||||||
implode("\n", $show_events).
|
implode("\n", $show_events).
|
||||||
'</div>';
|
'</div>';
|
||||||
}
|
}
|
||||||
|
@ -213,7 +225,7 @@ final class AphrontCalendarMonthView extends AphrontView {
|
||||||
|
|
||||||
if ($event_end > $epoch_end) {
|
if ($event_end > $epoch_end) {
|
||||||
$classes[] = 'aphront-calendar-event-continues-after';
|
$classes[] = 'aphront-calendar-event-continues-after';
|
||||||
$when[] = 'Ends '.phabricator_datetime($event_start, $user);
|
$when[] = 'Ends '.phabricator_datetime($event_end, $user);
|
||||||
} else {
|
} else {
|
||||||
$when[] = 'Ends at '.phabricator_time($event_end, $user);
|
$when[] = 'Ends at '.phabricator_time($event_end, $user);
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,9 +36,10 @@ table.aphront-calendar-view td div.aphront-calendar-day {
|
||||||
}
|
}
|
||||||
|
|
||||||
.aphront-calendar-holiday {
|
.aphront-calendar-holiday {
|
||||||
float: left;
|
|
||||||
color: #666666;
|
color: #666666;
|
||||||
padding: .5em;
|
padding: .5em;
|
||||||
|
max-height: 1em;
|
||||||
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.aphront-calendar-date-number {
|
.aphront-calendar-date-number {
|
||||||
|
@ -83,6 +84,11 @@ table.aphront-calendar-view td div.aphront-calendar-day {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.aphront-calendar-event-empty {
|
||||||
|
border-color: transparent;
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
.aphront-calendar-event-text {
|
.aphront-calendar-event-text {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
|
|
Loading…
Add table
Reference in a new issue