From f087d7c08a02348aa84c0aa0efbfe4a53ef77222 Mon Sep 17 00:00:00 2001 From: lkassianik Date: Sun, 17 May 2015 12:31:26 -0700 Subject: [PATCH] Add week numbers to Calendar month view. Summary: Closes T8184, Add week numbers to Calendar month view. Test Plan: Calendar month view should now show week numbers, incrementing on Mondays, regardless of week start day. Reviewers: chad, #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T8184 Differential Revision: https://secure.phabricator.com/D12886 --- resources/celerity/map.php | 4 ++-- src/view/phui/calendar/PHUICalendarMonthView.php | 12 ++++++++++++ .../rsrc/css/phui/calendar/phui-calendar-month.css | 9 +++++++++ 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/resources/celerity/map.php b/resources/celerity/map.php index 9d0c4f7014..3aecd78dfc 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -122,7 +122,7 @@ return array( 'rsrc/css/layout/phabricator-source-code-view.css' => '2ceee894', 'rsrc/css/phui/calendar/phui-calendar-day.css' => '3b4a65d8', 'rsrc/css/phui/calendar/phui-calendar-list.css' => '840baa8d', - 'rsrc/css/phui/calendar/phui-calendar-month.css' => 'a6993b38', + 'rsrc/css/phui/calendar/phui-calendar-month.css' => '5b213ea0', 'rsrc/css/phui/calendar/phui-calendar.css' => '8345be98', 'rsrc/css/phui/phui-action-header-view.css' => '89c497e7', 'rsrc/css/phui/phui-action-list.css' => '4f4d09f2', @@ -763,7 +763,7 @@ return array( 'phui-calendar-css' => '8345be98', 'phui-calendar-day-css' => '3b4a65d8', 'phui-calendar-list-css' => '840baa8d', - 'phui-calendar-month-css' => 'a6993b38', + 'phui-calendar-month-css' => '5b213ea0', '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 d6bb7d1a32..df692d271d 100644 --- a/src/view/phui/calendar/PHUICalendarMonthView.php +++ b/src/view/phui/calendar/PHUICalendarMonthView.php @@ -189,6 +189,7 @@ final class PHUICalendarMonthView extends AphrontView { $class = $event_list['class']; $date = $event_list['date']; $cell_day_secret_link = null; + $week_number = null; if ($date) { $uri = $event_list['uri']; @@ -201,6 +202,16 @@ final class PHUICalendarMonthView extends AphrontView { 'href' => $uri, ), $date->format('j')); + + if ($date->format('w') == 1) { + $week_number = phutil_tag( + 'a', + array( + 'class' => 'phui-calendar-week-number', + 'href' => $uri, + ), + $date->format('W')); + } } else { $cell_day = null; } @@ -234,6 +245,7 @@ final class PHUICalendarMonthView extends AphrontView { ), array( $cell_day_secret_link, + $week_number, $cell_day, $today_slot, )); diff --git a/webroot/rsrc/css/phui/calendar/phui-calendar-month.css b/webroot/rsrc/css/phui/calendar/phui-calendar-month.css index 14d25e7f67..6b5c0aeb86 100644 --- a/webroot/rsrc/css/phui/calendar/phui-calendar-month.css +++ b/webroot/rsrc/css/phui/calendar/phui-calendar-month.css @@ -94,6 +94,15 @@ table.phui-calendar-view tr td:first-child { color: {$green}; } +table.phui-calendar-view a.phui-calendar-week-number { + color: {$lightgreyborder}; + padding: 4px; + display: inline-block; + min-width: 16px; + text-align: center; + float: left; +} + table.phui-calendar-view a.phui-calendar-date-number { color: {$lightgreytext}; padding: 4px;