Implement very basic uberhome
Summary:
No fancy-pants smarty stuff yet, but merges /applications/ and the awful application buttons into the dark navigation.
Hover state is maybe a little weird.
Test Plan: {F29324}
Reviewers: chad, btrahan
Reviewed By: btrahan
CC: aran, btrahan, codeblock
Differential Revision: https://secure.phabricator.com/D4431
This commit is contained in:
@@ -4,39 +4,26 @@ final class PhabricatorDirectoryMainController
|
||||
extends PhabricatorDirectoryController {
|
||||
|
||||
private $filter;
|
||||
private $subfilter;
|
||||
|
||||
public function willProcessRequest(array $data) {
|
||||
$this->filter = idx($data, 'filter');
|
||||
$this->subfilter = idx($data, 'subfilter');
|
||||
}
|
||||
|
||||
public function processRequest() {
|
||||
$user = $this->getRequest()->getUser();
|
||||
|
||||
if ($this->filter == 'jump') {
|
||||
return $this->buildJumpResponse();
|
||||
}
|
||||
|
||||
$nav = $this->buildNav();
|
||||
$this->filter = $nav->selectFilter($this->filter, 'home');
|
||||
|
||||
switch ($this->filter) {
|
||||
case 'jump':
|
||||
break;
|
||||
case 'home':
|
||||
$project_query = new PhabricatorProjectQuery();
|
||||
$project_query->setViewer($user);
|
||||
$project_query->withMemberPHIDs(array($user->getPHID()));
|
||||
$projects = $project_query->execute();
|
||||
break;
|
||||
default:
|
||||
throw new Exception("Unknown filter '{$this->filter}'!");
|
||||
}
|
||||
|
||||
switch ($this->filter) {
|
||||
case 'jump':
|
||||
return $this->buildJumpResponse($nav);
|
||||
default:
|
||||
return $this->buildMainResponse($nav, $projects);
|
||||
}
|
||||
$project_query = new PhabricatorProjectQuery();
|
||||
$project_query->setViewer($user);
|
||||
$project_query->withMemberPHIDs(array($user->getPHID()));
|
||||
$projects = $project_query->execute();
|
||||
|
||||
return $this->buildMainResponse($nav, $projects);
|
||||
}
|
||||
|
||||
private function buildMainResponse($nav, array $projects) {
|
||||
@@ -56,12 +43,10 @@ final class PhabricatorDirectoryMainController
|
||||
|
||||
$jump_panel = $this->buildJumpPanel();
|
||||
$revision_panel = $this->buildRevisionPanel();
|
||||
$app_panel = $this->buildAppPanel();
|
||||
$audit_panel = $this->buildAuditPanel();
|
||||
$commit_panel = $this->buildCommitPanel();
|
||||
|
||||
$content = array(
|
||||
$app_panel,
|
||||
$jump_panel,
|
||||
$unbreak_panel,
|
||||
$triage_panel,
|
||||
@@ -82,7 +67,7 @@ final class PhabricatorDirectoryMainController
|
||||
));
|
||||
}
|
||||
|
||||
private function buildJumpResponse($nav) {
|
||||
private function buildJumpResponse() {
|
||||
$request = $this->getRequest();
|
||||
|
||||
$jump = $request->getStr('jump');
|
||||
@@ -97,15 +82,9 @@ final class PhabricatorDirectoryMainController
|
||||
|
||||
return id(new AphrontRedirectResponse())
|
||||
->setURI('/search/'.$query->getQueryKey().'/');
|
||||
} else {
|
||||
return id(new AphrontRedirectResponse())->setURI('/');
|
||||
}
|
||||
|
||||
|
||||
$nav->appendChild($this->buildJumpPanel($jump));
|
||||
return $this->buildStandardPageResponse(
|
||||
$nav,
|
||||
array(
|
||||
'title' => 'Jump Nav',
|
||||
));
|
||||
}
|
||||
|
||||
private function buildUnbreakNowPanel() {
|
||||
@@ -389,105 +368,6 @@ final class PhabricatorDirectoryMainController
|
||||
return $panel;
|
||||
}
|
||||
|
||||
private function buildAppPanel() {
|
||||
require_celerity_resource('phabricator-app-buttons-css');
|
||||
|
||||
$nav_buttons = array();
|
||||
|
||||
$nav_buttons[] = array(
|
||||
'Differential',
|
||||
'/differential/',
|
||||
'differential',
|
||||
'Code Reviews');
|
||||
|
||||
if (PhabricatorEnv::getEnvConfig('maniphest.enabled')) {
|
||||
$nav_buttons[] = array(
|
||||
'Maniphest',
|
||||
'/maniphest/',
|
||||
'maniphest',
|
||||
'Tasks');
|
||||
$nav_buttons[] = array(
|
||||
'Create Task',
|
||||
'/maniphest/task/create/',
|
||||
'create-task');
|
||||
}
|
||||
|
||||
$nav_buttons[] = array(
|
||||
'Upload File',
|
||||
'/file/upload/',
|
||||
'upload-file',
|
||||
'Share Files');
|
||||
$nav_buttons[] = array(
|
||||
'Create Paste',
|
||||
'/paste/create/',
|
||||
'create-paste',
|
||||
'Share Text');
|
||||
|
||||
|
||||
if (PhabricatorEnv::getEnvConfig('phriction.enabled')) {
|
||||
$nav_buttons[] = array(
|
||||
'Phriction',
|
||||
'/w/',
|
||||
'phriction',
|
||||
'Browse Wiki');
|
||||
}
|
||||
|
||||
$nav_buttons[] = array(
|
||||
'Diffusion',
|
||||
'/diffusion/',
|
||||
'diffusion',
|
||||
'Browse Code');
|
||||
|
||||
$nav_buttons[] = array(
|
||||
'Audit',
|
||||
'/audit/',
|
||||
'audit',
|
||||
'Audit Code');
|
||||
|
||||
$view = new AphrontNullView();
|
||||
$view->appendChild('<div class="phabricator-app-buttons">');
|
||||
foreach ($nav_buttons as $info) {
|
||||
// Subtitle is optional.
|
||||
list($name, $uri, $icon, $subtitle) = array_merge($info, array(null));
|
||||
|
||||
if ($subtitle) {
|
||||
$subtitle =
|
||||
'<div class="phabricator-app-subtitle">'.
|
||||
phutil_escape_html($subtitle).
|
||||
'</div>';
|
||||
}
|
||||
|
||||
$button = phutil_render_tag(
|
||||
'a',
|
||||
array(
|
||||
'href' => $uri,
|
||||
'class' => 'app-button icon-'.$icon,
|
||||
),
|
||||
phutil_render_tag(
|
||||
'div',
|
||||
array(
|
||||
'class' => 'app-icon icon-'.$icon,
|
||||
),
|
||||
''));
|
||||
$caption = phutil_render_tag(
|
||||
'a',
|
||||
array(
|
||||
'href' => $uri,
|
||||
'class' => 'phabricator-button-caption',
|
||||
),
|
||||
phutil_escape_html($name).$subtitle);
|
||||
|
||||
$view->appendChild(
|
||||
'<div class="phabricator-app-button">'.
|
||||
$button.
|
||||
$caption.
|
||||
'</div>');
|
||||
}
|
||||
$view->appendChild('<div style="clear: both;"></div></div>');
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
||||
private function renderMiniPanel($title, $body) {
|
||||
$panel = new AphrontMiniPanelView();
|
||||
$panel->appendChild(
|
||||
|
||||
Reference in New Issue
Block a user