mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-15 01:01:09 +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:
parent
9885165fb9
commit
977ac2a8fe
4 changed files with 21 additions and 3 deletions
|
@ -741,7 +741,7 @@ celerity_register_resource_map(array(
|
||||||
),
|
),
|
||||||
'aphront-calendar-view-css' =>
|
'aphront-calendar-view-css' =>
|
||||||
array(
|
array(
|
||||||
'uri' => '/res/73061a31/rsrc/css/aphront/calendar-view.css',
|
'uri' => '/res/ae6f5b54/rsrc/css/aphront/calendar-view.css',
|
||||||
'type' => 'css',
|
'type' => 'css',
|
||||||
'requires' =>
|
'requires' =>
|
||||||
array(
|
array(
|
||||||
|
|
|
@ -11,6 +11,8 @@ final class PhabricatorCalendarBrowseController
|
||||||
$year = $request->getInt('year', $year_d);
|
$year = $request->getInt('year', $year_d);
|
||||||
$month_d = phabricator_format_local_time($now, $user, 'm');
|
$month_d = phabricator_format_local_time($now, $user, 'm');
|
||||||
$month = $request->getInt('month', $month_d);
|
$month = $request->getInt('month', $month_d);
|
||||||
|
$day = phabricator_format_local_time($now, $user, 'j');
|
||||||
|
|
||||||
|
|
||||||
$holidays = id(new PhabricatorCalendarHoliday())->loadAllWhere(
|
$holidays = id(new PhabricatorCalendarHoliday())->loadAllWhere(
|
||||||
'day BETWEEN %s AND %s',
|
'day BETWEEN %s AND %s',
|
||||||
|
@ -23,7 +25,12 @@ final class PhabricatorCalendarBrowseController
|
||||||
strtotime("{$year}-{$month}-01"),
|
strtotime("{$year}-{$month}-01"),
|
||||||
strtotime("{$year}-{$month}-01 next month"));
|
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->setBrowseURI($request->getRequestURI());
|
||||||
$month_view->setUser($user);
|
$month_view->setUser($user);
|
||||||
$month_view->setHolidays($holidays);
|
$month_view->setHolidays($holidays);
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
final class AphrontCalendarMonthView extends AphrontView {
|
final class AphrontCalendarMonthView extends AphrontView {
|
||||||
|
|
||||||
|
private $day;
|
||||||
private $month;
|
private $month;
|
||||||
private $year;
|
private $year;
|
||||||
private $holidays = array();
|
private $holidays = array();
|
||||||
|
@ -27,7 +28,8 @@ final class AphrontCalendarMonthView extends AphrontView {
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function __construct($month, $year) {
|
public function __construct($month, $year, $day = null) {
|
||||||
|
$this->day = $day;
|
||||||
$this->month = $month;
|
$this->month = $month;
|
||||||
$this->year = $year;
|
$this->year = $year;
|
||||||
}
|
}
|
||||||
|
@ -65,6 +67,11 @@ final class AphrontCalendarMonthView extends AphrontView {
|
||||||
$holiday = idx($this->holidays, $day->format('Y-m-d'));
|
$holiday = idx($this->holidays, $day->format('Y-m-d'));
|
||||||
$class = 'aphront-calendar-day';
|
$class = 'aphront-calendar-day';
|
||||||
$weekday = $day->format('w');
|
$weekday = $day->format('w');
|
||||||
|
|
||||||
|
if ($day_number == $this->day) {
|
||||||
|
$class .= ' aphront-calendar-today';
|
||||||
|
}
|
||||||
|
|
||||||
if ($holiday || $weekday == 0 || $weekday == 6) {
|
if ($holiday || $weekday == 0 || $weekday == 6) {
|
||||||
$class .= ' aphront-calendar-not-work-day';
|
$class .= ' aphront-calendar-not-work-day';
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,6 +75,10 @@ table.aphront-calendar-view td div.aphront-calendar-day {
|
||||||
background-color: #fdfae7;
|
background-color: #fdfae7;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.aphront-calendar-today {
|
||||||
|
background-color: #A6FAAD;
|
||||||
|
}
|
||||||
|
|
||||||
.aphront-calendar-empty {
|
.aphront-calendar-empty {
|
||||||
background-color: #ededed;
|
background-color: #ededed;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue