Skip to content

Commit d3268ae

Browse files
author
lkassianik
committed
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
1 parent 680e8fd commit d3268ae

File tree

3 files changed

+28
-11
lines changed

3 files changed

+28
-11
lines changed

resources/celerity/map.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@
123123
'rsrc/css/layout/phabricator-source-code-view.css' => '2ceee894',
124124
'rsrc/css/phui/calendar/phui-calendar-day.css' => 'c0cf782a',
125125
'rsrc/css/phui/calendar/phui-calendar-list.css' => 'c1c7f338',
126-
'rsrc/css/phui/calendar/phui-calendar-month.css' => '94b1750a',
126+
'rsrc/css/phui/calendar/phui-calendar-month.css' => '476be7e0',
127127
'rsrc/css/phui/calendar/phui-calendar.css' => 'ccabe893',
128128
'rsrc/css/phui/phui-action-header-view.css' => '89c497e7',
129129
'rsrc/css/phui/phui-action-list.css' => '4f4d09f2',
@@ -767,7 +767,7 @@
767767
'phui-calendar-css' => 'ccabe893',
768768
'phui-calendar-day-css' => 'c0cf782a',
769769
'phui-calendar-list-css' => 'c1c7f338',
770-
'phui-calendar-month-css' => '94b1750a',
770+
'phui-calendar-month-css' => '476be7e0',
771771
'phui-crumbs-view-css' => '594d719e',
772772
'phui-document-view-css' => '94d5dcd8',
773773
'phui-feed-story-css' => 'c9f3a0b5',

src/view/phui/calendar/PHUICalendarMonthView.php

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,10 @@ public function render() {
117117

118118
foreach ($cell_lists_by_week as $week_of_cell_lists) {
119119
$cells = array();
120+
$max_count = $this->getMaxDailyEventsForWeek($week_of_cell_lists);
121+
120122
foreach ($week_of_cell_lists as $cell_list) {
121-
$cells[] = $this->getEventListCell($cell_list);
123+
$cells[] = $this->getEventListCell($cell_list, $max_count);
122124
}
123125
$rows[] = phutil_tag('tr', array(), $cells);
124126

@@ -153,7 +155,19 @@ public function render() {
153155
return $box;
154156
}
155157

156-
private function getEventListCell($event_list) {
158+
private function getMaxDailyEventsForWeek($week_of_cell_lists) {
159+
$max_count = 0;
160+
161+
foreach ($week_of_cell_lists as $cell_list) {
162+
if ($cell_list['count'] > $max_count) {
163+
$max_count = $cell_list['count'];
164+
}
165+
}
166+
167+
return $max_count;
168+
}
169+
170+
private function getEventListCell($event_list, $max_count = 0) {
157171
$list = $event_list['list'];
158172
$class = $event_list['class'];
159173
$uri = $event_list['uri'];
@@ -162,7 +176,7 @@ private function getEventListCell($event_list) {
162176
$viewer_is_invited = $list->getIsViewerInvitedOnList();
163177

164178
$event_count_badge = $this->getEventCountBadge($count, $viewer_is_invited);
165-
$cell_day_secret_link = $this->getHiddenDayLink($uri);
179+
$cell_day_secret_link = $this->getHiddenDayLink($uri, $max_count, 125);
166180

167181
$cell_data_div = phutil_tag(
168182
'div',
@@ -191,7 +205,7 @@ private function getDayNumberCell($event_list) {
191205

192206
if ($date) {
193207
$uri = $event_list['uri'];
194-
$cell_day_secret_link = $this->getHiddenDayLink($uri);
208+
$cell_day_secret_link = $this->getHiddenDayLink($uri, 0, 25);
195209

196210
$cell_day = phutil_tag(
197211
'a',
@@ -291,11 +305,16 @@ private function getEventCountBadge($count, $viewer_is_invited) {
291305
$event_count);
292306
}
293307

294-
private function getHiddenDayLink($uri) {
308+
private function getHiddenDayLink($uri, $count, $max_height) {
309+
// approximately the height of the tallest cell
310+
$height = 18 * $count + 5;
311+
$height = ($height > $max_height) ? $height : $max_height;
312+
$height_style = 'height: '.$height.'px';
295313
return phutil_tag(
296314
'a',
297315
array(
298316
'class' => 'phui-calendar-month-secret-link',
317+
'style' => $height_style,
299318
'href' => $uri,
300319
),
301320
null);

webroot/rsrc/css/phui/calendar/phui-calendar-month.css

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,6 @@ a.phui-calendar-month-secret-link {
5454
position: absolute;
5555
left: 0;
5656
right: 0;
57-
top: 0;
58-
bottom: 0;
59-
outline: 0;
6057
}
6158

6259
table.phui-calendar-view tr td:first-child {
@@ -149,7 +146,8 @@ table.phui-calendar-view td.phui-calendar-date-number-container {
149146
background: transparent;
150147
}
151148

152-
.phui-calendar-view .phui-calendar-list {
149+
.phui-calendar-view .phui-calendar-list,
150+
.phui-calendar-view .phui-calendar-month-list {
153151
padding: 1px;
154152
width: auto;
155153
}

0 commit comments

Comments
 (0)