mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-20 04:20:55 +01:00
Refactoring to use PHUICalendarListView
instead of boxes
Summary: Ref T4393, Refactoring to use `PHUICalendarListView` instead of boxes Test Plan: See new sidebar Reviewers: chad, #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T4393 Differential Revision: https://secure.phabricator.com/D12743
This commit is contained in:
parent
7fd401d0e0
commit
78438951c8
7 changed files with 41 additions and 166 deletions
|
@ -119,7 +119,7 @@ return array(
|
||||||
'rsrc/css/layout/phabricator-hovercard-view.css' => '44394670',
|
'rsrc/css/layout/phabricator-hovercard-view.css' => '44394670',
|
||||||
'rsrc/css/layout/phabricator-side-menu-view.css' => 'c1db9e9c',
|
'rsrc/css/layout/phabricator-side-menu-view.css' => 'c1db9e9c',
|
||||||
'rsrc/css/layout/phabricator-source-code-view.css' => '2ceee894',
|
'rsrc/css/layout/phabricator-source-code-view.css' => '2ceee894',
|
||||||
'rsrc/css/phui/calendar/phui-calendar-day.css' => 'c2eb34ce',
|
'rsrc/css/phui/calendar/phui-calendar-day.css' => '75b8cc4a',
|
||||||
'rsrc/css/phui/calendar/phui-calendar-list.css' => 'c1d0ca59',
|
'rsrc/css/phui/calendar/phui-calendar-list.css' => 'c1d0ca59',
|
||||||
'rsrc/css/phui/calendar/phui-calendar-month.css' => 'a92e47d2',
|
'rsrc/css/phui/calendar/phui-calendar-month.css' => 'a92e47d2',
|
||||||
'rsrc/css/phui/calendar/phui-calendar.css' => '8675968e',
|
'rsrc/css/phui/calendar/phui-calendar.css' => '8675968e',
|
||||||
|
@ -773,7 +773,7 @@ return array(
|
||||||
'phui-box-css' => '7b3a2eed',
|
'phui-box-css' => '7b3a2eed',
|
||||||
'phui-button-css' => 'de610129',
|
'phui-button-css' => 'de610129',
|
||||||
'phui-calendar-css' => '8675968e',
|
'phui-calendar-css' => '8675968e',
|
||||||
'phui-calendar-day-css' => 'c2eb34ce',
|
'phui-calendar-day-css' => '75b8cc4a',
|
||||||
'phui-calendar-list-css' => 'c1d0ca59',
|
'phui-calendar-list-css' => 'c1d0ca59',
|
||||||
'phui-calendar-month-css' => 'a92e47d2',
|
'phui-calendar-month-css' => 'a92e47d2',
|
||||||
'phui-crumbs-view-css' => '594d719e',
|
'phui-crumbs-view-css' => '594d719e',
|
||||||
|
|
|
@ -389,7 +389,7 @@ final class PhabricatorCalendarEventSearchEngine
|
||||||
$phids = mpull($statuses, 'getUserPHID');
|
$phids = mpull($statuses, 'getUserPHID');
|
||||||
|
|
||||||
foreach ($statuses as $status) {
|
foreach ($statuses as $status) {
|
||||||
$event = new AphrontCalendarDayEventView();
|
$event = new AphrontCalendarEventView();
|
||||||
$event->setEventID($status->getID());
|
$event->setEventID($status->getID());
|
||||||
$event->setEpochRange($status->getDateFrom(), $status->getDateTo());
|
$event->setEpochRange($status->getDateFrom(), $status->getDateTo());
|
||||||
|
|
||||||
|
|
|
@ -1,58 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
final class AphrontCalendarDayEventView extends AphrontView {
|
|
||||||
|
|
||||||
private $eventID;
|
|
||||||
private $epochStart;
|
|
||||||
private $epochEnd;
|
|
||||||
private $name;
|
|
||||||
private $uri;
|
|
||||||
|
|
||||||
public function setEventID($event_id) {
|
|
||||||
$this->eventID = $event_id;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getEventID() {
|
|
||||||
return $this->eventID;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setName($name) {
|
|
||||||
$this->name = $name;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getName() {
|
|
||||||
return $this->name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setURI($uri) {
|
|
||||||
$this->uri = $uri;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getURI() {
|
|
||||||
return $this->uri;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setEpochRange($start, $end) {
|
|
||||||
$this->epochStart = $start;
|
|
||||||
$this->epochEnd = $end;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getEpochStart() {
|
|
||||||
return $this->epochStart;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getEpochEnd() {
|
|
||||||
return $this->epochEnd;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function render() {
|
|
||||||
$box = new PHUIObjectBoxView();
|
|
||||||
$box->setHeaderText($this->name);
|
|
||||||
return $box;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -9,6 +9,16 @@ final class AphrontCalendarEventView extends AphrontView {
|
||||||
private $description;
|
private $description;
|
||||||
private $eventID;
|
private $eventID;
|
||||||
private $color;
|
private $color;
|
||||||
|
private $uri;
|
||||||
|
|
||||||
|
public function setURI($uri) {
|
||||||
|
$this->uri = $uri;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getURI() {
|
||||||
|
return $this->uri;
|
||||||
|
}
|
||||||
|
|
||||||
public function setEventID($event_id) {
|
public function setEventID($event_id) {
|
||||||
$this->eventID = $event_id;
|
$this->eventID = $event_id;
|
||||||
|
|
|
@ -8,7 +8,7 @@ final class PHUICalendarDayView extends AphrontView {
|
||||||
private $browseURI;
|
private $browseURI;
|
||||||
private $events = array();
|
private $events = array();
|
||||||
|
|
||||||
public function addEvent(AphrontCalendarDayEventView $event) {
|
public function addEvent(AphrontCalendarEventView $event) {
|
||||||
$this->events[] = $event;
|
$this->events[] = $event;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
@ -121,41 +121,21 @@ final class PHUICalendarDayView extends AphrontView {
|
||||||
|
|
||||||
$table_box = id(new PHUIObjectBoxView())
|
$table_box = id(new PHUIObjectBoxView())
|
||||||
->setHeader($header)
|
->setHeader($header)
|
||||||
->appendChild($table);
|
->appendChild($table)
|
||||||
|
->setFlush(true);
|
||||||
$column1 = phutil_tag(
|
|
||||||
'div',
|
|
||||||
array(
|
|
||||||
'class' => 'pm',
|
|
||||||
),
|
|
||||||
$sidebar);
|
|
||||||
|
|
||||||
$column2 = phutil_tag(
|
|
||||||
'div',
|
|
||||||
array(
|
|
||||||
'class' => 'pm',
|
|
||||||
),
|
|
||||||
$table_box);
|
|
||||||
|
|
||||||
$layout = id(new AphrontMultiColumnView())
|
$layout = id(new AphrontMultiColumnView())
|
||||||
->addColumn($column1, 'third')
|
->addColumn($sidebar, 'third')
|
||||||
->addColumn($column2, 'thirds')
|
->addColumn($table_box, 'thirds')
|
||||||
->setFluidLayout(true)
|
->setFluidLayout(true)
|
||||||
->setGutter(AphrontMultiColumnView::GUTTER_MEDIUM);
|
->setGutter(AphrontMultiColumnView::GUTTER_MEDIUM);
|
||||||
|
|
||||||
$wrap = phutil_tag(
|
return phutil_tag(
|
||||||
'div',
|
'div',
|
||||||
array(
|
array(
|
||||||
'class' => 'ml',
|
'class' => 'ml',
|
||||||
),
|
),
|
||||||
$layout);
|
$layout);
|
||||||
|
|
||||||
return phutil_tag(
|
|
||||||
'div',
|
|
||||||
array(),
|
|
||||||
array(
|
|
||||||
$wrap,
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function renderSidebar() {
|
private function renderSidebar() {
|
||||||
|
@ -163,11 +143,10 @@ final class PHUICalendarDayView extends AphrontView {
|
||||||
$week_of_boxes = $this->getWeekOfBoxes();
|
$week_of_boxes = $this->getWeekOfBoxes();
|
||||||
$filled_boxes = array();
|
$filled_boxes = array();
|
||||||
|
|
||||||
foreach ($week_of_boxes as $box) {
|
foreach ($week_of_boxes as $weekly_box) {
|
||||||
$start = $box['start'];
|
$start = $weekly_box['start'];
|
||||||
$end = id(clone $start)->modify('+1 day');
|
$end = id(clone $start)->modify('+1 day');
|
||||||
|
|
||||||
$box = $box['box'];
|
|
||||||
$box_events = array();
|
$box_events = array();
|
||||||
|
|
||||||
foreach ($this->events as $event) {
|
foreach ($this->events as $event) {
|
||||||
|
@ -176,65 +155,32 @@ final class PHUICalendarDayView extends AphrontView {
|
||||||
$box_events[] = $event;
|
$box_events[] = $event;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$filled_boxes[] = $this->renderSidebarBox($box_events, $box);
|
$filled_boxes[] = $this->renderSidebarBox(
|
||||||
|
$box_events,
|
||||||
|
$weekly_box['title']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $filled_boxes;
|
return $filled_boxes;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function renderSidebarBox($events, $box) {
|
private function renderSidebarBox($events, $title) {
|
||||||
$user = $this->user;
|
$widget = new PHUICalendarWidgetView();
|
||||||
$rows = array();
|
|
||||||
|
|
||||||
foreach ($events as $key => $event) {
|
$list = id(new PHUICalendarListView())
|
||||||
$uri = $event->getURI();
|
->setUser($this->user);
|
||||||
$name = $event->getName();
|
|
||||||
$time = id(AphrontFormDateControlValue::newFromEpoch(
|
|
||||||
$user,
|
|
||||||
$event->getEpochStart()))
|
|
||||||
->getValueTime();
|
|
||||||
|
|
||||||
$name = phutil_tag(
|
if (count($events) == 0) {
|
||||||
'a',
|
$list->showBlankState(true);
|
||||||
array(
|
} else {
|
||||||
'href' => $uri,
|
foreach ($events as $event) {
|
||||||
),
|
$list->addEvent($event);
|
||||||
$name);
|
}
|
||||||
|
|
||||||
$name = phutil_tag(
|
|
||||||
'td',
|
|
||||||
array(
|
|
||||||
'class' => 'calendar-day-sidebar-column-name',
|
|
||||||
),
|
|
||||||
$name);
|
|
||||||
|
|
||||||
$time = phutil_tag(
|
|
||||||
'td',
|
|
||||||
array(
|
|
||||||
'class' => 'calendar-day-sidebar-column-time',
|
|
||||||
),
|
|
||||||
$time);
|
|
||||||
|
|
||||||
$rows[] = phutil_tag(
|
|
||||||
'tr',
|
|
||||||
array(
|
|
||||||
'class' => 'calendar-day-sidebar-row',
|
|
||||||
),
|
|
||||||
array(
|
|
||||||
$name,
|
|
||||||
$time,
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$table = phutil_tag(
|
$widget
|
||||||
'table',
|
->setCalendarList($list)
|
||||||
array(
|
->setHeader($title);
|
||||||
'class' => 'calendar-day-sidebar-today-table',
|
return $widget;
|
||||||
),
|
|
||||||
$rows);
|
|
||||||
|
|
||||||
$box->appendChild($table);
|
|
||||||
return $box;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getWeekOfBoxes() {
|
private function getWeekOfBoxes() {
|
||||||
|
@ -259,7 +205,7 @@ final class PHUICalendarDayView extends AphrontView {
|
||||||
}
|
}
|
||||||
|
|
||||||
$sidebar_day_boxes[] = array(
|
$sidebar_day_boxes[] = array(
|
||||||
'box' => id(new PHUIObjectBoxView())->setHeaderText($title),
|
'title' => $title,
|
||||||
'start' => clone $box_start_time,
|
'start' => clone $box_start_time,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -339,7 +285,7 @@ final class PHUICalendarDayView extends AphrontView {
|
||||||
}
|
}
|
||||||
|
|
||||||
private function drawEvent(
|
private function drawEvent(
|
||||||
AphrontCalendarDayEventView $event,
|
AphrontCalendarEventView $event,
|
||||||
$offset,
|
$offset,
|
||||||
$width,
|
$width,
|
||||||
$top,
|
$top,
|
||||||
|
|
|
@ -123,7 +123,7 @@ final class PHUICalendarListView extends AphrontTagView {
|
||||||
'size' => 200,
|
'size' => 200,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
$description);
|
$event->getName());
|
||||||
|
|
||||||
return $anchor;
|
return $anchor;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,29 +7,6 @@
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.calendar-day-sidebar-today-table {
|
|
||||||
width: 100%;
|
|
||||||
margin: 8px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.calendar-day-sidebar-column-name {
|
|
||||||
text-align: left;
|
|
||||||
color: {$bluetext};
|
|
||||||
width: 60%;
|
|
||||||
padding: 4px 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.calendar-day-sidebar-column-name a {
|
|
||||||
color: {$bluetext};
|
|
||||||
}
|
|
||||||
|
|
||||||
.calendar-day-sidebar-column-time {
|
|
||||||
color: {$bluetext};
|
|
||||||
text-align: right;
|
|
||||||
width: 40%;
|
|
||||||
padding: 4px 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.phui-calendar-day-hour {
|
.phui-calendar-day-hour {
|
||||||
width: 60px;
|
width: 60px;
|
||||||
color: {$lightgreytext};
|
color: {$lightgreytext};
|
||||||
|
|
Loading…
Reference in a new issue