1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-22 14:52: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 $events = array();
private $blankState; private $blankState;
private $view; private $view;
private $moreLink;
public function setMoreLink($more_link) {
$this->moreLink = $more_link;
return $this;
}
public function getMoreLink() {
return $this->moreLink;
}
private function getView() { private function getView() {
return $this->view; return $this->view;
@ -60,7 +70,7 @@ final class PHUICalendarListView extends AphrontTagView {
$icon_icon = $event->getIcon(); $icon_icon = $event->getIcon();
$icon_color = $event->getIconColor(); $icon_color = $event->getIconColor();
$dot = id(new PHUIIconView()) $icon = id(new PHUIIconView())
->setIcon($icon_icon, $icon_color) ->setIcon($icon_icon, $icon_color)
->addClass('phui-calendar-list-item-icon'); ->addClass('phui-calendar-list-item-icon');
@ -108,7 +118,7 @@ final class PHUICalendarListView extends AphrontTagView {
), ),
), ),
array( array(
$dot, $icon,
$time, $time,
$title, $title,
)); ));
@ -121,6 +131,29 @@ final class PHUICalendarListView extends AphrontTagView {
$content); $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)) { if (empty($singletons)) {
$singletons[] = phutil_tag( $singletons[] = phutil_tag(
'li', 'li',

View file

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