mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-18 19:40:55 +01:00
This week should be marked with a bottom blue horizontal bar in Calendar month view.
Summary: Closes T8185, This week should be marked with a bottom blue horizontal bar in Calendar month view. Test Plan: Open calendar month view, "this week" should show a dark blue bar under it and a lighter blue bar on "today". Reviewers: chad, #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T8185 Differential Revision: https://secure.phabricator.com/D12862
This commit is contained in:
parent
27b78d2147
commit
e3134a1d47
3 changed files with 62 additions and 6 deletions
|
@ -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' => '7819a8b1',
|
||||
'rsrc/css/phui/calendar/phui-calendar-month.css' => '4fba442e',
|
||||
'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' => '7819a8b1',
|
||||
'phui-calendar-month-css' => '4fba442e',
|
||||
'phui-crumbs-view-css' => '594d719e',
|
||||
'phui-document-view-css' => '94d5dcd8',
|
||||
'phui-feed-story-css' => 'c9f3a0b5',
|
||||
|
|
|
@ -228,6 +228,15 @@ final class PHUICalendarMonthView extends AphrontView {
|
|||
$today_class = 'phui-calendar-today-slot';
|
||||
}
|
||||
|
||||
if ($this->isDateInCurrentWeek($date)) {
|
||||
$today_class .= ' phui-calendar-this-week';
|
||||
}
|
||||
|
||||
$last_week_day = 6;
|
||||
if ($date->format('w') == $last_week_day) {
|
||||
$today_class .= ' last-weekday';
|
||||
}
|
||||
|
||||
$today_slot = phutil_tag (
|
||||
'div',
|
||||
array(
|
||||
|
@ -254,6 +263,16 @@ final class PHUICalendarMonthView extends AphrontView {
|
|||
$cell_div);
|
||||
}
|
||||
|
||||
private function isDateInCurrentWeek($date) {
|
||||
list($week_start_date, $week_end_date) = $this->getThisWeekRange();
|
||||
|
||||
if ($date->format('U') < $week_end_date->format('U') &&
|
||||
$date->format('U') >= $week_start_date->format('U')) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private function getEventCountBadge($count, $viewer_is_invited) {
|
||||
$class = 'phui-calendar-month-count-badge';
|
||||
|
||||
|
@ -484,6 +503,34 @@ final class PHUICalendarMonthView extends AphrontView {
|
|||
return $days;
|
||||
}
|
||||
|
||||
private function getTodayMidnight() {
|
||||
$viewer = $this->getUser();
|
||||
$today = new DateTime('@'.time());
|
||||
$today->setTimeZone($viewer->getTimeZone());
|
||||
$today->setTime(0, 0, 0);
|
||||
|
||||
return $today;
|
||||
}
|
||||
|
||||
private function getThisWeekRange() {
|
||||
$week_start = 0;
|
||||
$week_end = 6;
|
||||
|
||||
$today = $this->getTodayMidnight();
|
||||
$date_weekday = $today->format('w');
|
||||
|
||||
$days_from_week_start = $date_weekday - $week_start;
|
||||
$days_to_week_end = $week_end - $date_weekday + 1;
|
||||
|
||||
$modify = '-'.$days_from_week_start.' days';
|
||||
$week_start_date = id(clone $today)->modify($modify);
|
||||
|
||||
$modify = '+'.$days_to_week_end.' days';
|
||||
$week_end_date = id(clone $today)->modify($modify);
|
||||
|
||||
return array($week_start_date, $week_end_date);
|
||||
}
|
||||
|
||||
private function getDateTime() {
|
||||
$user = $this->user;
|
||||
$timezone = new DateTimeZone($user->getTimezoneIdentifier());
|
||||
|
|
|
@ -96,7 +96,7 @@ table.phui-calendar-view tr td:first-child {
|
|||
|
||||
table.phui-calendar-view a.phui-calendar-date-number {
|
||||
color: {$lightgreytext};
|
||||
padding: 0 4px;
|
||||
padding: 4px;
|
||||
display: inline-block;
|
||||
min-width: 16px;
|
||||
text-align: center;
|
||||
|
@ -111,10 +111,19 @@ table.phui-calendar-view td.phui-calendar-date-number-container {
|
|||
|
||||
.phui-calendar-today-slot {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 4px;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: -1px;
|
||||
bottom: 0;
|
||||
}
|
||||
|
||||
.phui-calendar-today-slot.last-weekday {
|
||||
right: 0px;
|
||||
}
|
||||
|
||||
.phui-calendar-today-slot.phui-calendar-this-week {
|
||||
background-color: {$blueborder};
|
||||
}
|
||||
|
||||
.phui-calendar-today-slot.phui-calendar-today {
|
||||
|
|
Loading…
Reference in a new issue