1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-20 20:40:56 +01:00

Provide better headers and crumbs for Calendar result views

Summary:
Ref T11326. This isn't perfect, but should be a little easier to use and less weird/confusing.

Generally, provide a "Query > Month > Day" crumb on day views, and a "Wed, July 3" header.

Generally, provide a "Query > Month" crumb on month views, and a "July 2019" header.

Also try to fix a bit of padding/spacing on the day view.

Test Plan: {F1739128}

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T11326

Differential Revision: https://secure.phabricator.com/D16338
This commit is contained in:
epriestley 2016-07-27 09:07:29 -07:00
parent ef6c689e87
commit eab74a9d7c
8 changed files with 112 additions and 35 deletions

View file

@ -115,8 +115,8 @@ return array(
'rsrc/css/layout/phabricator-filetree-view.css' => 'fccf9f82', 'rsrc/css/layout/phabricator-filetree-view.css' => 'fccf9f82',
'rsrc/css/layout/phabricator-side-menu-view.css' => 'dd849797', 'rsrc/css/layout/phabricator-side-menu-view.css' => 'dd849797',
'rsrc/css/layout/phabricator-source-code-view.css' => 'cbeef983', 'rsrc/css/layout/phabricator-source-code-view.css' => 'cbeef983',
'rsrc/css/phui/calendar/phui-calendar-day.css' => 'f15bb6d6', 'rsrc/css/phui/calendar/phui-calendar-day.css' => '572b1893',
'rsrc/css/phui/calendar/phui-calendar-list.css' => '5d89cd71', 'rsrc/css/phui/calendar/phui-calendar-list.css' => 'fcc9fb41',
'rsrc/css/phui/calendar/phui-calendar-month.css' => '8e10e92c', 'rsrc/css/phui/calendar/phui-calendar-month.css' => '8e10e92c',
'rsrc/css/phui/calendar/phui-calendar.css' => 'daadaf39', 'rsrc/css/phui/calendar/phui-calendar.css' => 'daadaf39',
'rsrc/css/phui/phui-action-list.css' => 'c5eba19d', 'rsrc/css/phui/phui-action-list.css' => 'c5eba19d',
@ -828,8 +828,8 @@ return array(
'phui-box-css' => '5c8387cf', 'phui-box-css' => '5c8387cf',
'phui-button-css' => '4a5fbe3d', 'phui-button-css' => '4a5fbe3d',
'phui-calendar-css' => 'daadaf39', 'phui-calendar-css' => 'daadaf39',
'phui-calendar-day-css' => 'f15bb6d6', 'phui-calendar-day-css' => '572b1893',
'phui-calendar-list-css' => '5d89cd71', 'phui-calendar-list-css' => 'fcc9fb41',
'phui-calendar-month-css' => '8e10e92c', 'phui-calendar-month-css' => '8e10e92c',
'phui-chart-css' => '6bf6f78e', 'phui-chart-css' => '6bf6f78e',
'phui-crumbs-view-css' => 'b4fa5755', 'phui-crumbs-view-css' => 'b4fa5755',

View file

@ -362,7 +362,18 @@ final class PhabricatorCalendarEventSearchEngine
$month_view->setBrowseURI( $month_view->setBrowseURI(
$this->getURI('query/'.$query->getQueryKey().'/')); $this->getURI('query/'.$query->getQueryKey().'/'));
$from = $this->getQueryDateFrom($query)->getDateTime();
$crumbs = array();
$crumbs[] = id(new PHUICrumbView())
->setName($from->format('F Y'));
$header = id(new PHUIHeaderView())
->setHeader($from->format('F Y'));
return id(new PhabricatorApplicationSearchResultView()) return id(new PhabricatorApplicationSearchResultView())
->setCrumbs($crumbs)
->setHeader($header)
->setContent($month_view) ->setContent($month_view)
->setCollapsed(true); ->setCollapsed(true);
} }
@ -380,8 +391,8 @@ final class PhabricatorCalendarEventSearchEngine
$query->getParameter('display')); $query->getParameter('display'));
$day_view = id(new PHUICalendarDayView( $day_view = id(new PHUICalendarDayView(
$this->getQueryDateFrom($query)->getEpoch(), $this->getQueryDateFrom($query),
$this->getQueryDateTo($query)->getEpoch(), $this->getQueryDateTo($query),
$start_year, $start_year,
$start_month, $start_month,
$start_day)) $start_day))
@ -417,10 +428,26 @@ final class PhabricatorCalendarEventSearchEngine
$day_view->addEvent($event_view); $day_view->addEvent($event_view);
} }
$day_view->setBrowseURI( $browse_uri = $this->getURI('query/'.$query->getQueryKey().'/');
$this->getURI('query/'.$query->getQueryKey().'/')); $day_view->setBrowseURI($browse_uri);
$from = $this->getQueryDateFrom($query)->getDateTime();
$month_uri = $browse_uri.$from->format('Y/m/');
$crumbs = array(
id(new PHUICrumbView())
->setName($from->format('F Y'))
->setHref($month_uri),
id(new PHUICrumbView())
->setName($from->format('D jS')),
);
$header = id(new PHUIHeaderView())
->setHeader($from->format('D, F jS'));
return id(new PhabricatorApplicationSearchResultView()) return id(new PhabricatorApplicationSearchResultView())
->setCrumbs($crumbs)
->setHeader($header)
->setContent($day_view) ->setContent($day_view)
->setCollapsed(true); ->setCollapsed(true);
} }
@ -466,6 +493,20 @@ final class PhabricatorCalendarEventSearchEngine
} }
private function getQueryDateFrom(PhabricatorSavedQuery $saved) { private function getQueryDateFrom(PhabricatorSavedQuery $saved) {
if ($this->calendarYear && $this->calendarMonth) {
$viewer = $this->requireViewer();
$start_year = $this->calendarYear;
$start_month = $this->calendarMonth;
$start_day = $this->calendarDay ? $this->calendarDay : 1;
return AphrontFormDateControlValue::newFromDictionary(
$viewer,
array(
'd' => "{$start_year}-{$start_month}-{$start_day}",
));
}
return $this->getQueryDate($saved, 'rangeStart'); return $this->getQueryDate($saved, 'rangeStart');
} }

View file

@ -210,7 +210,7 @@ final class PhabricatorApplicationSearchController
} }
$body[] = $box; $body[] = $box;
$more_crumbs = null;
if ($run_query) { if ($run_query) {
$exec_errors = array(); $exec_errors = array();
@ -272,6 +272,13 @@ final class PhabricatorApplicationSearchController
$box->setCollapsed(true); $box->setCollapsed(true);
} }
$result_header = $list->getHeader();
if ($result_header) {
$box->setHeader($result_header);
}
$more_crumbs = $list->getCrumbs();
if ($pager->willShowPagingControls()) { if ($pager->willShowPagingControls()) {
$pager_box = id(new PHUIBoxView()) $pager_box = id(new PHUIBoxView())
->addPadding(PHUI::PADDING_MEDIUM) ->addPadding(PHUI::PADDING_MEDIUM)
@ -301,8 +308,18 @@ final class PhabricatorApplicationSearchController
} }
$crumbs = $parent $crumbs = $parent
->buildApplicationCrumbs() ->buildApplicationCrumbs();
->addTextCrumb($title);
if ($more_crumbs) {
$query_uri = $engine->getQueryResultsPageURI($saved_query->getQueryKey());
$crumbs->addTextCrumb($title, $query_uri);
foreach ($more_crumbs as $crumb) {
$crumbs->addCrumb($crumb);
}
} else {
$crumbs->addTextCrumb($title);
}
return $this->newPage() return $this->newPage()
->setApplicationMenu($this->buildApplicationMenu()) ->setApplicationMenu($this->buildApplicationMenu())

View file

@ -14,6 +14,8 @@ final class PhabricatorApplicationSearchResultView extends Phobject {
private $actions = array(); private $actions = array();
private $collapsed = null; private $collapsed = null;
private $noDataString; private $noDataString;
private $crumbs = array();
private $header;
public function setObjectList(PHUIObjectItemListView $list) { public function setObjectList(PHUIObjectItemListView $list) {
$this->objectList = $list; $this->objectList = $list;
@ -82,4 +84,26 @@ final class PhabricatorApplicationSearchResultView extends Phobject {
return $this; return $this;
} }
public function setCrumbs(array $crumbs) {
assert_instances_of($crumbs, 'PHUICrumbView');
$this->crumbs = $crumbs;
return $this;
}
public function getCrumbs() {
return $this->crumbs;
}
public function setHeader(PHUIHeaderView $header) {
$this->header = $header;
return $this;
}
public function getHeader() {
return $this->header;
}
} }

View file

@ -59,27 +59,6 @@ final class AphrontFormDateControlValue extends Phobject {
return $this->viewer; return $this->viewer;
} }
public static function newFromParts(
PhabricatorUser $viewer,
$year,
$month,
$day,
$time = null,
$enabled = true) {
$value = new AphrontFormDateControlValue();
$value->viewer = $viewer;
list($value->valueDate, $value->valueTime) =
$value->getFormattedDateFromParts(
$year,
$month,
$day,
coalesce($time, '12:00 AM'));
$value->valueEnabled = $enabled;
return $value;
}
public static function newFromRequest(AphrontRequest $request, $key) { public static function newFromRequest(AphrontRequest $request, $key) {
$value = new AphrontFormDateControlValue(); $value = new AphrontFormDateControlValue();
$value->viewer = $request->getViewer(); $value->viewer = $request->getViewer();

View file

@ -445,8 +445,7 @@ final class PHUICalendarMonthView extends AphrontView {
} }
$header = id(new PHUIHeaderView()) $header = id(new PHUIHeaderView());
->setHeader($date->format('F Y'));
if ($button_bar) { if ($button_bar) {
$header->setButtonBar($button_bar); $header->setButtonBar($button_bar);

View file

@ -92,7 +92,6 @@ div.phui-calendar-day-event.all-day {
background-color: {$bluebackground}; background-color: {$bluebackground};
color: {$greytext}; color: {$greytext};
text-decoration: none; text-decoration: none;
text-decoration: none;
} }
.day-view-all-day { .day-view-all-day {

View file

@ -66,4 +66,22 @@
.phui-calendar-list-item-empty { .phui-calendar-list-item-empty {
color: {$lightgreytext}; color: {$lightgreytext};
padding: 0 12px;
font-style: italic;
}
.phui-calendar-list-item.all-day {
background: {$bluebackground};
}
.calendar-day-view-sidebar .phui-calendar-list {
padding: 12px 0;
}
.calendar-day-view-sidebar .phui-calendar-list-item {
padding: 0 12px;
}
.calendar-day-view-sidebar .phui-calendar-list-item a {
position: relative;
} }