mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 00:42:41 +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' =>
|
||||
array(
|
||||
'uri' => '/res/4fd79240/rsrc/css/aphront/calendar-view.css',
|
||||
'uri' => '/res/b200376d/rsrc/css/aphront/calendar-view.css',
|
||||
'type' => 'css',
|
||||
'requires' =>
|
||||
array(
|
||||
|
|
|
@ -51,6 +51,7 @@ final class PhabricatorCalendarBrowseController
|
|||
|
||||
$name_text = $handles[$status->getUserPHID()]->getName();
|
||||
$status_text = $status->getTextStatus();
|
||||
$event->setUserPHID($status->getUserPHID());
|
||||
$event->setName("{$name_text} ({$status_text})");
|
||||
$event->setDescription($status->getStatusDescription($user));
|
||||
$month_view->addEvent($event);
|
||||
|
|
|
@ -18,11 +18,21 @@
|
|||
|
||||
final class AphrontCalendarEventView extends AphrontView {
|
||||
|
||||
private $userPHID;
|
||||
private $name;
|
||||
private $epochStart;
|
||||
private $epochEnd;
|
||||
private $description;
|
||||
|
||||
public function setUserPHID($user_phid) {
|
||||
$this->userPHID = $user_phid;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getUserPHID() {
|
||||
return $this->userPHID;
|
||||
}
|
||||
|
||||
public function setName($name) {
|
||||
$this->name = $name;
|
||||
return $this;
|
||||
|
|
|
@ -69,6 +69,8 @@ final class AphrontCalendarMonthView extends AphrontView {
|
|||
$markup[] = $empty_box;
|
||||
}
|
||||
|
||||
$show_events = array();
|
||||
|
||||
foreach ($days as $day) {
|
||||
$holiday = idx($this->holidays, $day->format('Y-m-d'));
|
||||
$class = 'aphront-calendar-day';
|
||||
|
@ -80,18 +82,27 @@ final class AphrontCalendarMonthView extends AphrontView {
|
|||
$day->setTime(0, 0, 0);
|
||||
$epoch_start = $day->format('U');
|
||||
|
||||
$day->setTime(23, 59, 59);
|
||||
$day->setTime(24, 0, 0);
|
||||
$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) {
|
||||
if ($event->getEpochStart() > $epoch_end) {
|
||||
if ($event->getEpochStart() >= $epoch_end) {
|
||||
// This list is sorted, so we can stop looking.
|
||||
break;
|
||||
}
|
||||
if ($event->getEpochStart() <= $epoch_end &&
|
||||
$event->getEpochEnd() >= $epoch_start) {
|
||||
$show_events[] = $this->renderEvent(
|
||||
if ($event->getEpochStart() < $epoch_end &&
|
||||
$event->getEpochEnd() > $epoch_start) {
|
||||
$show_events[$event->getUserPHID()] = $this->renderEvent(
|
||||
$event,
|
||||
$day,
|
||||
$epoch_start,
|
||||
|
@ -101,18 +112,19 @@ final class AphrontCalendarMonthView extends AphrontView {
|
|||
|
||||
$holiday_markup = null;
|
||||
if ($holiday) {
|
||||
$name = phutil_escape_html($holiday->getName());
|
||||
$holiday_markup =
|
||||
'<div class="aphront-calendar-holiday">'.
|
||||
phutil_escape_html($holiday->getName()).
|
||||
'<div class="aphront-calendar-holiday" title="'.$name.'">'.
|
||||
$name.
|
||||
'</div>';
|
||||
}
|
||||
|
||||
$markup[] =
|
||||
'<div class="'.$class.'">'.
|
||||
$holiday_markup.
|
||||
'<div class="aphront-calendar-date-number">'.
|
||||
$day->format('j').
|
||||
'</div>'.
|
||||
$holiday_markup.
|
||||
implode("\n", $show_events).
|
||||
'</div>';
|
||||
}
|
||||
|
@ -213,7 +225,7 @@ final class AphrontCalendarMonthView extends AphrontView {
|
|||
|
||||
if ($event_end > $epoch_end) {
|
||||
$classes[] = 'aphront-calendar-event-continues-after';
|
||||
$when[] = 'Ends '.phabricator_datetime($event_start, $user);
|
||||
$when[] = 'Ends '.phabricator_datetime($event_end, $user);
|
||||
} else {
|
||||
$when[] = 'Ends at '.phabricator_time($event_end, $user);
|
||||
}
|
||||
|
|
|
@ -36,9 +36,10 @@ table.aphront-calendar-view td div.aphront-calendar-day {
|
|||
}
|
||||
|
||||
.aphront-calendar-holiday {
|
||||
float: left;
|
||||
color: #666666;
|
||||
padding: .5em;
|
||||
max-height: 1em;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.aphront-calendar-date-number {
|
||||
|
@ -83,6 +84,11 @@ table.aphront-calendar-view td div.aphront-calendar-day {
|
|||
overflow: hidden;
|
||||
}
|
||||
|
||||
.aphront-calendar-event-empty {
|
||||
border-color: transparent;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.aphront-calendar-event-text {
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
|
|
Loading…
Reference in a new issue