From d3268aecc226397a09e47b8b24aebe48f226fe9c Mon Sep 17 00:00:00 2001 From: lkassianik Date: Thu, 21 May 2015 17:11:26 -0700 Subject: [PATCH] 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 --- resources/celerity/map.php | 4 +-- .../phui/calendar/PHUICalendarMonthView.php | 29 +++++++++++++++---- .../css/phui/calendar/phui-calendar-month.css | 6 ++-- 3 files changed, 28 insertions(+), 11 deletions(-) diff --git a/resources/celerity/map.php b/resources/celerity/map.php index 3f062c9513..ad88264ee5 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -123,7 +123,7 @@ return array( 'rsrc/css/layout/phabricator-source-code-view.css' => '2ceee894', 'rsrc/css/phui/calendar/phui-calendar-day.css' => 'c0cf782a', '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/phui-action-header-view.css' => '89c497e7', 'rsrc/css/phui/phui-action-list.css' => '4f4d09f2', @@ -767,7 +767,7 @@ return array( 'phui-calendar-css' => 'ccabe893', 'phui-calendar-day-css' => 'c0cf782a', 'phui-calendar-list-css' => 'c1c7f338', - 'phui-calendar-month-css' => '94b1750a', + 'phui-calendar-month-css' => '476be7e0', 'phui-crumbs-view-css' => '594d719e', 'phui-document-view-css' => '94d5dcd8', 'phui-feed-story-css' => 'c9f3a0b5', diff --git a/src/view/phui/calendar/PHUICalendarMonthView.php b/src/view/phui/calendar/PHUICalendarMonthView.php index 806ecad719..3adbe5eae7 100644 --- a/src/view/phui/calendar/PHUICalendarMonthView.php +++ b/src/view/phui/calendar/PHUICalendarMonthView.php @@ -117,8 +117,10 @@ final class PHUICalendarMonthView extends AphrontView { foreach ($cell_lists_by_week as $week_of_cell_lists) { $cells = array(); + $max_count = $this->getMaxDailyEventsForWeek($week_of_cell_lists); + 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); @@ -153,7 +155,19 @@ final class PHUICalendarMonthView extends AphrontView { 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']; $class = $event_list['class']; $uri = $event_list['uri']; @@ -162,7 +176,7 @@ final class PHUICalendarMonthView extends AphrontView { $viewer_is_invited = $list->getIsViewerInvitedOnList(); $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( 'div', @@ -191,7 +205,7 @@ final class PHUICalendarMonthView extends AphrontView { if ($date) { $uri = $event_list['uri']; - $cell_day_secret_link = $this->getHiddenDayLink($uri); + $cell_day_secret_link = $this->getHiddenDayLink($uri, 0, 25); $cell_day = phutil_tag( 'a', @@ -291,11 +305,16 @@ final class PHUICalendarMonthView extends AphrontView { $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( 'a', array( 'class' => 'phui-calendar-month-secret-link', + 'style' => $height_style, 'href' => $uri, ), null); diff --git a/webroot/rsrc/css/phui/calendar/phui-calendar-month.css b/webroot/rsrc/css/phui/calendar/phui-calendar-month.css index d528c260f1..a219e49cf7 100644 --- a/webroot/rsrc/css/phui/calendar/phui-calendar-month.css +++ b/webroot/rsrc/css/phui/calendar/phui-calendar-month.css @@ -54,9 +54,6 @@ a.phui-calendar-month-secret-link { position: absolute; left: 0; right: 0; - top: 0; - bottom: 0; - outline: 0; } table.phui-calendar-view tr td:first-child { @@ -149,7 +146,8 @@ table.phui-calendar-view td.phui-calendar-date-number-container { background: transparent; } -.phui-calendar-view .phui-calendar-list { +.phui-calendar-view .phui-calendar-list, +.phui-calendar-view .phui-calendar-month-list { padding: 1px; width: auto; }