Add a way to get to the home dashboard on mobile

Summary: Fixes T5320. Adds a "Home" application at the top, for mobile-only.

Test Plan: See screenshots.

Reviewers: chad

Reviewed By: chad

Subscribers: epriestley

Maniphest Tasks: T5320

Differential Revision: https://secure.phabricator.com/D9509
This commit is contained in:
epriestley
2014-06-12 19:16:53 -07:00
parent 0e1042db85
commit d0c09ef867
5 changed files with 56 additions and 36 deletions

View File

@@ -3,7 +3,7 @@
final class PhabricatorHomeMainController
extends PhabricatorHomeController {
private $filter;
private $only;
private $minipanels = array();
public function shouldAllowPublic() {
@@ -11,44 +11,49 @@ final class PhabricatorHomeMainController
}
public function willProcessRequest(array $data) {
$this->filter = idx($data, 'filter');
$this->only = idx($data, 'only');
}
public function processRequest() {
$user = $this->getRequest()->getUser();
$nav = $this->buildNav();
$dashboard = PhabricatorDashboardInstall::getDashboard(
$user,
$user->getPHID(),
get_class($this->getCurrentApplication()));
if ($dashboard) {
$rendered_dashboard = id(new PhabricatorDashboardRenderingEngine())
$content = id(new PhabricatorDashboardRenderingEngine())
->setViewer($user)
->setDashboard($dashboard)
->renderDashboard();
$nav->appendChild($rendered_dashboard);
} else {
$project_query = new PhabricatorProjectQuery();
$project_query->setViewer($user);
$project_query->withMemberPHIDs(array($user->getPHID()));
$projects = $project_query->execute();
$nav = $this->buildMainResponse($nav, $projects);
$content = $this->buildMainResponse($projects);
}
$nav->appendChild(id(new PhabricatorGlobalUploadTargetView())
->setUser($user));
if (!$this->only) {
$nav = $this->buildNav();
$nav->appendChild(
array(
$content,
id(new PhabricatorGlobalUploadTargetView())->setUser($user),
));
$content = $nav;
}
return $this->buildApplicationPage(
$nav,
$content,
array(
'title' => 'Phabricator',
'device' => true,
));
}
private function buildMainResponse($nav, array $projects) {
private function buildMainResponse(array $projects) {
assert_instances_of($projects, 'PhabricatorProject');
$viewer = $this->getRequest()->getUser();
@@ -94,7 +99,7 @@ final class PhabricatorHomeMainController
$revision_panel = null;
}
$content = array(
return array(
$welcome_panel,
$unbreak_panel,
$triage_panel,
@@ -104,11 +109,6 @@ final class PhabricatorHomeMainController
$commit_panel,
$this->minipanels,
);
$nav->appendChild($content);
return $nav;
}
private function buildUnbreakNowPanel() {