1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-14 16:51:08 +01:00

Highlighting the current day in calendar.

Summary:
Highlights the current day :)
I am not great in choosing colors. @chad can suggest some improvements :)

Test Plan: {F41738}

Reviewers: epriestley

Reviewed By: epriestley

CC: chad, aran, Korvin, AnhNhan

Maniphest Tasks: T2627

Differential Revision: https://secure.phabricator.com/D5790
This commit is contained in:
Afaque Hussain 2013-04-29 12:15:38 -07:00 committed by epriestley
parent 9885165fb9
commit 977ac2a8fe
4 changed files with 21 additions and 3 deletions

View file

@ -741,7 +741,7 @@ celerity_register_resource_map(array(
),
'aphront-calendar-view-css' =>
array(
'uri' => '/res/73061a31/rsrc/css/aphront/calendar-view.css',
'uri' => '/res/ae6f5b54/rsrc/css/aphront/calendar-view.css',
'type' => 'css',
'requires' =>
array(

View file

@ -11,6 +11,8 @@ final class PhabricatorCalendarBrowseController
$year = $request->getInt('year', $year_d);
$month_d = phabricator_format_local_time($now, $user, 'm');
$month = $request->getInt('month', $month_d);
$day = phabricator_format_local_time($now, $user, 'j');
$holidays = id(new PhabricatorCalendarHoliday())->loadAllWhere(
'day BETWEEN %s AND %s',
@ -23,7 +25,12 @@ final class PhabricatorCalendarBrowseController
strtotime("{$year}-{$month}-01"),
strtotime("{$year}-{$month}-01 next month"));
$month_view = new AphrontCalendarMonthView($month, $year);
if ($month == $month_d && $year == $year_d) {
$month_view = new AphrontCalendarMonthView($month, $year, $day);
} else {
$month_view = new AphrontCalendarMonthView($month, $year);
}
$month_view->setBrowseURI($request->getRequestURI());
$month_view->setUser($user);
$month_view->setHolidays($holidays);

View file

@ -2,6 +2,7 @@
final class AphrontCalendarMonthView extends AphrontView {
private $day;
private $month;
private $year;
private $holidays = array();
@ -27,7 +28,8 @@ final class AphrontCalendarMonthView extends AphrontView {
return $this;
}
public function __construct($month, $year) {
public function __construct($month, $year, $day = null) {
$this->day = $day;
$this->month = $month;
$this->year = $year;
}
@ -65,6 +67,11 @@ final class AphrontCalendarMonthView extends AphrontView {
$holiday = idx($this->holidays, $day->format('Y-m-d'));
$class = 'aphront-calendar-day';
$weekday = $day->format('w');
if ($day_number == $this->day) {
$class .= ' aphront-calendar-today';
}
if ($holiday || $weekday == 0 || $weekday == 6) {
$class .= ' aphront-calendar-not-work-day';
}

View file

@ -75,6 +75,10 @@ table.aphront-calendar-view td div.aphront-calendar-day {
background-color: #fdfae7;
}
.aphront-calendar-today {
background-color: #A6FAAD;
}
.aphront-calendar-empty {
background-color: #ededed;
}