1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 00:42:41 +01:00

When a Calendar day has too many events, show a "More..." link

Summary: Fixes T8361.

Test Plan: {F1739073}

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T8361

Differential Revision: https://secure.phabricator.com/D16337
This commit is contained in:
epriestley 2016-07-27 08:23:27 -07:00
parent 89f6764e1b
commit ef6c689e87
2 changed files with 41 additions and 5 deletions

View file

@ -5,6 +5,16 @@ final class PHUICalendarListView extends AphrontTagView {
private $events = array();
private $blankState;
private $view;
private $moreLink;
public function setMoreLink($more_link) {
$this->moreLink = $more_link;
return $this;
}
public function getMoreLink() {
return $this->moreLink;
}
private function getView() {
return $this->view;
@ -60,7 +70,7 @@ final class PHUICalendarListView extends AphrontTagView {
$icon_icon = $event->getIcon();
$icon_color = $event->getIconColor();
$dot = id(new PHUIIconView())
$icon = id(new PHUIIconView())
->setIcon($icon_icon, $icon_color)
->addClass('phui-calendar-list-item-icon');
@ -108,7 +118,7 @@ final class PHUICalendarListView extends AphrontTagView {
),
),
array(
$dot,
$icon,
$time,
$title,
));
@ -121,6 +131,29 @@ final class PHUICalendarListView extends AphrontTagView {
$content);
}
if ($this->moreLink) {
$singletons[] = phutil_tag(
'li',
array(
'class' => 'phui-calendar-list-item',
),
phutil_tag(
'a',
array(
'href' => $this->moreLink,
'class' => 'phui-calendar-list-more',
),
array(
id(new PHUIIconView())->setIcon('fa-ellipsis-h grey'),
phutil_tag(
'span',
array(
'class' => 'phui-calendar-list-title',
),
pht('View More...')),
)));
}
if (empty($singletons)) {
$singletons[] = phutil_tag(
'li',

View file

@ -95,13 +95,13 @@ final class PHUICalendarMonthView extends AphrontView {
->setViewer($viewer)
->setView('month');
foreach ($all_day_events as $item) {
if ($counter <= $max_daily) {
if ($counter < $max_daily) {
$list->addEvent($item);
}
$counter++;
}
foreach ($list_events as $item) {
if ($counter <= $max_daily) {
if ($counter < $max_daily) {
$list->addEvent($item);
}
$counter++;
@ -112,8 +112,11 @@ final class PHUICalendarMonthView extends AphrontView {
$day->format('m').'/'.
$day->format('d').'/';
$day_id = $day->format('Ymd');
if ($counter > $max_daily) {
$list->setMoreLink($uri);
}
$day_id = $day->format('Ymd');
$classes = array();
if ($day->format('m') != $this->month) {