1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-09 16:32:39 +01:00

Possible fix for month view day deadzone

Summary: Ref T8193, Possible fix for month view day deadzone

Test Plan: Open Calendar month view in Chrome, Firefox, or Safari. Verify that days with many events still link to the day views of those days.

Reviewers: chad, epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Maniphest Tasks: T8193

Differential Revision: https://secure.phabricator.com/D12969
This commit is contained in:
lkassianik 2015-05-21 17:11:26 -07:00
parent 680e8fdfdb
commit d3268aecc2
3 changed files with 28 additions and 11 deletions

View file

@ -123,7 +123,7 @@ return array(
'rsrc/css/layout/phabricator-source-code-view.css' => '2ceee894', 'rsrc/css/layout/phabricator-source-code-view.css' => '2ceee894',
'rsrc/css/phui/calendar/phui-calendar-day.css' => 'c0cf782a', 'rsrc/css/phui/calendar/phui-calendar-day.css' => 'c0cf782a',
'rsrc/css/phui/calendar/phui-calendar-list.css' => 'c1c7f338', 'rsrc/css/phui/calendar/phui-calendar-list.css' => 'c1c7f338',
'rsrc/css/phui/calendar/phui-calendar-month.css' => '94b1750a', 'rsrc/css/phui/calendar/phui-calendar-month.css' => '476be7e0',
'rsrc/css/phui/calendar/phui-calendar.css' => 'ccabe893', 'rsrc/css/phui/calendar/phui-calendar.css' => 'ccabe893',
'rsrc/css/phui/phui-action-header-view.css' => '89c497e7', 'rsrc/css/phui/phui-action-header-view.css' => '89c497e7',
'rsrc/css/phui/phui-action-list.css' => '4f4d09f2', 'rsrc/css/phui/phui-action-list.css' => '4f4d09f2',
@ -767,7 +767,7 @@ return array(
'phui-calendar-css' => 'ccabe893', 'phui-calendar-css' => 'ccabe893',
'phui-calendar-day-css' => 'c0cf782a', 'phui-calendar-day-css' => 'c0cf782a',
'phui-calendar-list-css' => 'c1c7f338', 'phui-calendar-list-css' => 'c1c7f338',
'phui-calendar-month-css' => '94b1750a', 'phui-calendar-month-css' => '476be7e0',
'phui-crumbs-view-css' => '594d719e', 'phui-crumbs-view-css' => '594d719e',
'phui-document-view-css' => '94d5dcd8', 'phui-document-view-css' => '94d5dcd8',
'phui-feed-story-css' => 'c9f3a0b5', 'phui-feed-story-css' => 'c9f3a0b5',

View file

@ -117,8 +117,10 @@ final class PHUICalendarMonthView extends AphrontView {
foreach ($cell_lists_by_week as $week_of_cell_lists) { foreach ($cell_lists_by_week as $week_of_cell_lists) {
$cells = array(); $cells = array();
$max_count = $this->getMaxDailyEventsForWeek($week_of_cell_lists);
foreach ($week_of_cell_lists as $cell_list) { foreach ($week_of_cell_lists as $cell_list) {
$cells[] = $this->getEventListCell($cell_list); $cells[] = $this->getEventListCell($cell_list, $max_count);
} }
$rows[] = phutil_tag('tr', array(), $cells); $rows[] = phutil_tag('tr', array(), $cells);
@ -153,7 +155,19 @@ final class PHUICalendarMonthView extends AphrontView {
return $box; return $box;
} }
private function getEventListCell($event_list) { private function getMaxDailyEventsForWeek($week_of_cell_lists) {
$max_count = 0;
foreach ($week_of_cell_lists as $cell_list) {
if ($cell_list['count'] > $max_count) {
$max_count = $cell_list['count'];
}
}
return $max_count;
}
private function getEventListCell($event_list, $max_count = 0) {
$list = $event_list['list']; $list = $event_list['list'];
$class = $event_list['class']; $class = $event_list['class'];
$uri = $event_list['uri']; $uri = $event_list['uri'];
@ -162,7 +176,7 @@ final class PHUICalendarMonthView extends AphrontView {
$viewer_is_invited = $list->getIsViewerInvitedOnList(); $viewer_is_invited = $list->getIsViewerInvitedOnList();
$event_count_badge = $this->getEventCountBadge($count, $viewer_is_invited); $event_count_badge = $this->getEventCountBadge($count, $viewer_is_invited);
$cell_day_secret_link = $this->getHiddenDayLink($uri); $cell_day_secret_link = $this->getHiddenDayLink($uri, $max_count, 125);
$cell_data_div = phutil_tag( $cell_data_div = phutil_tag(
'div', 'div',
@ -191,7 +205,7 @@ final class PHUICalendarMonthView extends AphrontView {
if ($date) { if ($date) {
$uri = $event_list['uri']; $uri = $event_list['uri'];
$cell_day_secret_link = $this->getHiddenDayLink($uri); $cell_day_secret_link = $this->getHiddenDayLink($uri, 0, 25);
$cell_day = phutil_tag( $cell_day = phutil_tag(
'a', 'a',
@ -291,11 +305,16 @@ final class PHUICalendarMonthView extends AphrontView {
$event_count); $event_count);
} }
private function getHiddenDayLink($uri) { private function getHiddenDayLink($uri, $count, $max_height) {
// approximately the height of the tallest cell
$height = 18 * $count + 5;
$height = ($height > $max_height) ? $height : $max_height;
$height_style = 'height: '.$height.'px';
return phutil_tag( return phutil_tag(
'a', 'a',
array( array(
'class' => 'phui-calendar-month-secret-link', 'class' => 'phui-calendar-month-secret-link',
'style' => $height_style,
'href' => $uri, 'href' => $uri,
), ),
null); null);

View file

@ -54,9 +54,6 @@ a.phui-calendar-month-secret-link {
position: absolute; position: absolute;
left: 0; left: 0;
right: 0; right: 0;
top: 0;
bottom: 0;
outline: 0;
} }
table.phui-calendar-view tr td:first-child { table.phui-calendar-view tr td:first-child {
@ -149,7 +146,8 @@ table.phui-calendar-view td.phui-calendar-date-number-container {
background: transparent; background: transparent;
} }
.phui-calendar-view .phui-calendar-list { .phui-calendar-view .phui-calendar-list,
.phui-calendar-view .phui-calendar-month-list {
padding: 1px; padding: 1px;
width: auto; width: auto;
} }