mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-18 19:40:55 +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:
parent
ef6c689e87
commit
eab74a9d7c
8 changed files with 112 additions and 35 deletions
|
@ -115,8 +115,8 @@ return array(
|
|||
'rsrc/css/layout/phabricator-filetree-view.css' => 'fccf9f82',
|
||||
'rsrc/css/layout/phabricator-side-menu-view.css' => 'dd849797',
|
||||
'rsrc/css/layout/phabricator-source-code-view.css' => 'cbeef983',
|
||||
'rsrc/css/phui/calendar/phui-calendar-day.css' => 'f15bb6d6',
|
||||
'rsrc/css/phui/calendar/phui-calendar-list.css' => '5d89cd71',
|
||||
'rsrc/css/phui/calendar/phui-calendar-day.css' => '572b1893',
|
||||
'rsrc/css/phui/calendar/phui-calendar-list.css' => 'fcc9fb41',
|
||||
'rsrc/css/phui/calendar/phui-calendar-month.css' => '8e10e92c',
|
||||
'rsrc/css/phui/calendar/phui-calendar.css' => 'daadaf39',
|
||||
'rsrc/css/phui/phui-action-list.css' => 'c5eba19d',
|
||||
|
@ -828,8 +828,8 @@ return array(
|
|||
'phui-box-css' => '5c8387cf',
|
||||
'phui-button-css' => '4a5fbe3d',
|
||||
'phui-calendar-css' => 'daadaf39',
|
||||
'phui-calendar-day-css' => 'f15bb6d6',
|
||||
'phui-calendar-list-css' => '5d89cd71',
|
||||
'phui-calendar-day-css' => '572b1893',
|
||||
'phui-calendar-list-css' => 'fcc9fb41',
|
||||
'phui-calendar-month-css' => '8e10e92c',
|
||||
'phui-chart-css' => '6bf6f78e',
|
||||
'phui-crumbs-view-css' => 'b4fa5755',
|
||||
|
|
|
@ -362,7 +362,18 @@ final class PhabricatorCalendarEventSearchEngine
|
|||
$month_view->setBrowseURI(
|
||||
$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())
|
||||
->setCrumbs($crumbs)
|
||||
->setHeader($header)
|
||||
->setContent($month_view)
|
||||
->setCollapsed(true);
|
||||
}
|
||||
|
@ -380,8 +391,8 @@ final class PhabricatorCalendarEventSearchEngine
|
|||
$query->getParameter('display'));
|
||||
|
||||
$day_view = id(new PHUICalendarDayView(
|
||||
$this->getQueryDateFrom($query)->getEpoch(),
|
||||
$this->getQueryDateTo($query)->getEpoch(),
|
||||
$this->getQueryDateFrom($query),
|
||||
$this->getQueryDateTo($query),
|
||||
$start_year,
|
||||
$start_month,
|
||||
$start_day))
|
||||
|
@ -417,10 +428,26 @@ final class PhabricatorCalendarEventSearchEngine
|
|||
$day_view->addEvent($event_view);
|
||||
}
|
||||
|
||||
$day_view->setBrowseURI(
|
||||
$this->getURI('query/'.$query->getQueryKey().'/'));
|
||||
$browse_uri = $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())
|
||||
->setCrumbs($crumbs)
|
||||
->setHeader($header)
|
||||
->setContent($day_view)
|
||||
->setCollapsed(true);
|
||||
}
|
||||
|
@ -466,6 +493,20 @@ final class PhabricatorCalendarEventSearchEngine
|
|||
}
|
||||
|
||||
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');
|
||||
}
|
||||
|
||||
|
|
|
@ -210,7 +210,7 @@ final class PhabricatorApplicationSearchController
|
|||
}
|
||||
|
||||
$body[] = $box;
|
||||
|
||||
$more_crumbs = null;
|
||||
|
||||
if ($run_query) {
|
||||
$exec_errors = array();
|
||||
|
@ -272,6 +272,13 @@ final class PhabricatorApplicationSearchController
|
|||
$box->setCollapsed(true);
|
||||
}
|
||||
|
||||
$result_header = $list->getHeader();
|
||||
if ($result_header) {
|
||||
$box->setHeader($result_header);
|
||||
}
|
||||
|
||||
$more_crumbs = $list->getCrumbs();
|
||||
|
||||
if ($pager->willShowPagingControls()) {
|
||||
$pager_box = id(new PHUIBoxView())
|
||||
->addPadding(PHUI::PADDING_MEDIUM)
|
||||
|
@ -301,8 +308,18 @@ final class PhabricatorApplicationSearchController
|
|||
}
|
||||
|
||||
$crumbs = $parent
|
||||
->buildApplicationCrumbs()
|
||||
->addTextCrumb($title);
|
||||
->buildApplicationCrumbs();
|
||||
|
||||
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()
|
||||
->setApplicationMenu($this->buildApplicationMenu())
|
||||
|
|
|
@ -14,6 +14,8 @@ final class PhabricatorApplicationSearchResultView extends Phobject {
|
|||
private $actions = array();
|
||||
private $collapsed = null;
|
||||
private $noDataString;
|
||||
private $crumbs = array();
|
||||
private $header;
|
||||
|
||||
public function setObjectList(PHUIObjectItemListView $list) {
|
||||
$this->objectList = $list;
|
||||
|
@ -82,4 +84,26 @@ final class PhabricatorApplicationSearchResultView extends Phobject {
|
|||
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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -59,27 +59,6 @@ final class AphrontFormDateControlValue extends Phobject {
|
|||
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) {
|
||||
$value = new AphrontFormDateControlValue();
|
||||
$value->viewer = $request->getViewer();
|
||||
|
|
|
@ -445,8 +445,7 @@ final class PHUICalendarMonthView extends AphrontView {
|
|||
|
||||
}
|
||||
|
||||
$header = id(new PHUIHeaderView())
|
||||
->setHeader($date->format('F Y'));
|
||||
$header = id(new PHUIHeaderView());
|
||||
|
||||
if ($button_bar) {
|
||||
$header->setButtonBar($button_bar);
|
||||
|
|
|
@ -92,7 +92,6 @@ div.phui-calendar-day-event.all-day {
|
|||
background-color: {$bluebackground};
|
||||
color: {$greytext};
|
||||
text-decoration: none;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.day-view-all-day {
|
||||
|
|
|
@ -66,4 +66,22 @@
|
|||
|
||||
.phui-calendar-list-item-empty {
|
||||
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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue