mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-30 09:20:58 +01:00
Make project page/navigation construction more consistent, particularly on mobile
Summary: Ref T10054. This mostly makes sure that mobile gets to have the same profile menu that Desktop does. Test Plan: - Viewed menus on mobile, saw all profile menu actions available. - Viewed/used changed pages (column detail, edit column, edit picture). Reviewers: chad Reviewed By: chad Maniphest Tasks: T10054 Differential Revision: https://secure.phabricator.com/D15008
This commit is contained in:
parent
7bde92b9c9
commit
102eacbfb7
13 changed files with 85 additions and 86 deletions
|
@ -3,11 +3,12 @@
|
||||||
abstract class PhabricatorProjectBoardController
|
abstract class PhabricatorProjectBoardController
|
||||||
extends PhabricatorProjectController {
|
extends PhabricatorProjectController {
|
||||||
|
|
||||||
public function buildIconNavView(PhabricatorProject $project) {
|
protected function getProfileMenu() {
|
||||||
$id = $project->getID();
|
$menu = parent::getProfileMenu();
|
||||||
$nav = parent::buildIconNavView($project);
|
|
||||||
$nav->selectFilter(PhabricatorProject::PANEL_WORKBOARD);
|
$menu->selectFilter(PhabricatorProject::PANEL_WORKBOARD);
|
||||||
$nav->addClass('project-board-nav');
|
$menu->addClass('project-board-nav');
|
||||||
return $nav;
|
|
||||||
|
return $menu;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -384,7 +384,7 @@ final class PhabricatorProjectBoardViewController
|
||||||
->appendChild($board)
|
->appendChild($board)
|
||||||
->addClass('project-board-wrapper');
|
->addClass('project-board-wrapper');
|
||||||
|
|
||||||
$nav = $this->buildIconNavView($project);
|
$nav = $this->getProfileMenu();
|
||||||
|
|
||||||
return $this->newPage()
|
return $this->newPage()
|
||||||
->setTitle(pht('%s Board', $project->getName()))
|
->setTitle(pht('%s Board', $project->getName()))
|
||||||
|
|
|
@ -49,15 +49,16 @@ final class PhabricatorProjectColumnDetailController
|
||||||
->setHeader($header)
|
->setHeader($header)
|
||||||
->addPropertyList($properties);
|
->addPropertyList($properties);
|
||||||
|
|
||||||
$nav = $this->buildIconNavView($project);
|
$nav = $this->getProfileMenu();
|
||||||
$nav->appendChild($box);
|
|
||||||
$nav->appendChild($timeline);
|
|
||||||
|
|
||||||
return $this->buildApplicationPage(
|
return $this->newPage()
|
||||||
$nav,
|
->setTitle($title)
|
||||||
array(
|
->setNavigation($nav)
|
||||||
'title' => $title,
|
->appendChild(
|
||||||
));
|
array(
|
||||||
|
$box,
|
||||||
|
$timeline,
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
private function buildHeaderView(PhabricatorProjectColumn $column) {
|
private function buildHeaderView(PhabricatorProjectColumn $column) {
|
||||||
|
|
|
@ -144,13 +144,11 @@ final class PhabricatorProjectColumnEditController
|
||||||
->setValidationException($validation_exception)
|
->setValidationException($validation_exception)
|
||||||
->setForm($form);
|
->setForm($form);
|
||||||
|
|
||||||
$nav = $this->buildIconNavView($project);
|
$nav = $this->getProfileMenu();
|
||||||
$nav->appendChild($form_box);
|
|
||||||
|
|
||||||
return $this->buildApplicationPage(
|
return $this->newPage()
|
||||||
$nav,
|
->setTitle($title)
|
||||||
array(
|
->setNavigation($nav)
|
||||||
'title' => $title,
|
->appendChild($form_box);
|
||||||
));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
abstract class PhabricatorProjectController extends PhabricatorController {
|
abstract class PhabricatorProjectController extends PhabricatorController {
|
||||||
|
|
||||||
private $project;
|
private $project;
|
||||||
|
private $profileMenu;
|
||||||
|
|
||||||
protected function setProject(PhabricatorProject $project) {
|
protected function setProject(PhabricatorProject $project) {
|
||||||
$this->project = $project;
|
$this->project = $project;
|
||||||
|
@ -80,50 +81,33 @@ abstract class PhabricatorProjectController extends PhabricatorController {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildApplicationMenu() {
|
public function buildApplicationMenu() {
|
||||||
return $this->buildSideNavView(true)->getMenu();
|
$menu = $this->newApplicationMenu();
|
||||||
|
|
||||||
|
$profile_menu = $this->getProfileMenu();
|
||||||
|
if ($profile_menu) {
|
||||||
|
$menu->setProfileMenu($profile_menu);
|
||||||
|
}
|
||||||
|
|
||||||
|
$menu->setSearchEngine(new PhabricatorProjectSearchEngine());
|
||||||
|
|
||||||
|
return $menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildSideNavView($for_app = false) {
|
protected function getProfileMenu() {
|
||||||
$project = $this->getProject();
|
if (!$this->profileMenu) {
|
||||||
|
$project = $this->getProject();
|
||||||
|
|
||||||
|
|
||||||
$nav = new AphrontSideNavFilterView();
|
|
||||||
$nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
|
|
||||||
|
|
||||||
$viewer = $this->getViewer();
|
|
||||||
|
|
||||||
$id = null;
|
|
||||||
if ($for_app) {
|
|
||||||
if ($project) {
|
if ($project) {
|
||||||
$id = $project->getID();
|
$viewer = $this->getViewer();
|
||||||
$nav->addFilter("profile/{$id}/", pht('Profile'));
|
|
||||||
$nav->addFilter("board/{$id}/", pht('Workboard'));
|
$engine = id(new PhabricatorProfilePanelEngine())
|
||||||
$nav->addFilter("members/{$id}/", pht('Members'));
|
->setViewer($viewer)
|
||||||
$nav->addFilter("feed/{$id}/", pht('Feed'));
|
->setProfileObject($project);
|
||||||
|
|
||||||
|
$this->profileMenu = $engine->buildNavigation();
|
||||||
}
|
}
|
||||||
$nav->addFilter('create', pht('Create Project'));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$id) {
|
return $this->profileMenu;
|
||||||
id(new PhabricatorProjectSearchEngine())
|
|
||||||
->setViewer($viewer)
|
|
||||||
->addNavigationItems($nav->getMenu());
|
|
||||||
}
|
|
||||||
|
|
||||||
$nav->selectFilter(null);
|
|
||||||
|
|
||||||
return $nav;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function buildIconNavView(PhabricatorProject $project) {
|
|
||||||
$viewer = $this->getViewer();
|
|
||||||
|
|
||||||
$engine = id(new PhabricatorProfilePanelEngine())
|
|
||||||
->setViewer($viewer)
|
|
||||||
->setProfileObject($project);
|
|
||||||
|
|
||||||
return $engine->buildNavigation();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function buildApplicationCrumbs() {
|
protected function buildApplicationCrumbs() {
|
||||||
|
|
|
@ -21,6 +21,8 @@ final class PhabricatorProjectEditPictureController
|
||||||
return new Aphront404Response();
|
return new Aphront404Response();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->setProject($project);
|
||||||
|
|
||||||
$edit_uri = $this->getApplicationURI('profile/'.$project->getID().'/');
|
$edit_uri = $this->getApplicationURI('profile/'.$project->getID().'/');
|
||||||
$view_uri = $this->getApplicationURI('profile/'.$project->getID().'/');
|
$view_uri = $this->getApplicationURI('profile/'.$project->getID().'/');
|
||||||
|
|
||||||
|
@ -280,15 +282,16 @@ final class PhabricatorProjectEditPictureController
|
||||||
->setHeaderText(pht('Upload New Picture'))
|
->setHeaderText(pht('Upload New Picture'))
|
||||||
->setForm($upload_form);
|
->setForm($upload_form);
|
||||||
|
|
||||||
$nav = $this->buildIconNavView($project);
|
$nav = $this->getProfileMenu();
|
||||||
$nav->selectFilter(PhabricatorProject::PANEL_PROFILE);
|
$nav->selectFilter(PhabricatorProject::PANEL_PROFILE);
|
||||||
$nav->appendChild($form_box);
|
|
||||||
$nav->appendChild($upload_box);
|
|
||||||
|
|
||||||
return $this->buildApplicationPage(
|
return $this->newPage()
|
||||||
$nav,
|
->setTitle($title)
|
||||||
array(
|
->setNavigation($nav)
|
||||||
'title' => $title,
|
->appendChild(
|
||||||
));
|
array(
|
||||||
|
$form_box,
|
||||||
|
$upload_box,
|
||||||
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ final class PhabricatorProjectFeedController
|
||||||
->setHeaderText(pht('Project Activity'))
|
->setHeaderText(pht('Project Activity'))
|
||||||
->appendChild($feed);
|
->appendChild($feed);
|
||||||
|
|
||||||
$nav = $this->buildIconNavView($project);
|
$nav = $this->getProfileMenu();
|
||||||
$nav->selectFilter('feed');
|
$nav->selectFilter('feed');
|
||||||
|
|
||||||
$crumbs = $this->buildApplicationCrumbs();
|
$crumbs = $this->buildApplicationCrumbs();
|
||||||
|
|
|
@ -8,19 +8,9 @@ final class PhabricatorProjectListController
|
||||||
}
|
}
|
||||||
|
|
||||||
public function handleRequest(AphrontRequest $request) {
|
public function handleRequest(AphrontRequest $request) {
|
||||||
$viewer = $request->getViewer();
|
return id(new PhabricatorProjectSearchEngine())
|
||||||
$query_key = $request->getURIData('queryKey');
|
->setController($this)
|
||||||
|
->buildResponse();
|
||||||
$controller = id(new PhabricatorApplicationSearchController())
|
|
||||||
->setQueryKey($query_key)
|
|
||||||
->setSearchEngine(new PhabricatorProjectSearchEngine())
|
|
||||||
->setNavigation($this->buildSideNavView());
|
|
||||||
|
|
||||||
return $this->delegateToController($controller);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function buildApplicationMenu() {
|
|
||||||
return $this->buildSideNavView(true)->getMenu();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function buildApplicationCrumbs() {
|
protected function buildApplicationCrumbs() {
|
||||||
|
|
|
@ -17,6 +17,8 @@ final class PhabricatorProjectMembersEditController
|
||||||
return new Aphront404Response();
|
return new Aphront404Response();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->setProject($project);
|
||||||
|
|
||||||
$member_phids = $project->getMemberPHIDs();
|
$member_phids = $project->getMemberPHIDs();
|
||||||
|
|
||||||
if ($request->isFormPost()) {
|
if ($request->isFormPost()) {
|
||||||
|
@ -95,7 +97,7 @@ final class PhabricatorProjectMembersEditController
|
||||||
|
|
||||||
$member_list = $this->renderMemberList($project, $handles);
|
$member_list = $this->renderMemberList($project, $handles);
|
||||||
|
|
||||||
$nav = $this->buildIconNavView($project);
|
$nav = $this->getProfileMenu();
|
||||||
$nav->selectFilter(PhabricatorProject::PANEL_MEMBERS);
|
$nav->selectFilter(PhabricatorProject::PANEL_MEMBERS);
|
||||||
|
|
||||||
$crumbs = $this->buildApplicationCrumbs();
|
$crumbs = $this->buildApplicationCrumbs();
|
||||||
|
|
|
@ -76,7 +76,7 @@ final class PhabricatorProjectMilestonesController
|
||||||
->setProjects($milestones)
|
->setProjects($milestones)
|
||||||
->renderList());
|
->renderList());
|
||||||
|
|
||||||
$nav = $this->buildIconNavView($project);
|
$nav = $this->getProfileMenu();
|
||||||
$nav->selectFilter(PhabricatorProject::PANEL_MILESTONES);
|
$nav->selectFilter(PhabricatorProject::PANEL_MILESTONES);
|
||||||
|
|
||||||
$crumbs = $this->buildApplicationCrumbs();
|
$crumbs = $this->buildApplicationCrumbs();
|
||||||
|
|
|
@ -43,7 +43,7 @@ final class PhabricatorProjectProfileController
|
||||||
new PhabricatorProjectTransactionQuery());
|
new PhabricatorProjectTransactionQuery());
|
||||||
$timeline->setShouldTerminate(true);
|
$timeline->setShouldTerminate(true);
|
||||||
|
|
||||||
$nav = $this->buildIconNavView($project);
|
$nav = $this->getProfileMenu();
|
||||||
$nav->selectFilter(PhabricatorProject::PANEL_PROFILE);
|
$nav->selectFilter(PhabricatorProject::PANEL_PROFILE);
|
||||||
|
|
||||||
$crumbs = $this->buildApplicationCrumbs();
|
$crumbs = $this->buildApplicationCrumbs();
|
||||||
|
|
|
@ -75,7 +75,7 @@ final class PhabricatorProjectSubprojectsController
|
||||||
->setProjects($subprojects)
|
->setProjects($subprojects)
|
||||||
->renderList());
|
->renderList());
|
||||||
|
|
||||||
$nav = $this->buildIconNavView($project);
|
$nav = $this->getProfileMenu();
|
||||||
$nav->selectFilter(PhabricatorProject::PANEL_SUBPROJECTS);
|
$nav->selectFilter(PhabricatorProject::PANEL_SUBPROJECTS);
|
||||||
|
|
||||||
$crumbs = $this->buildApplicationCrumbs();
|
$crumbs = $this->buildApplicationCrumbs();
|
||||||
|
|
|
@ -5,6 +5,7 @@ final class PHUIApplicationMenuView extends Phobject {
|
||||||
private $viewer;
|
private $viewer;
|
||||||
private $crumbs;
|
private $crumbs;
|
||||||
private $searchEngine;
|
private $searchEngine;
|
||||||
|
private $profileMenu;
|
||||||
|
|
||||||
private $items = array();
|
private $items = array();
|
||||||
|
|
||||||
|
@ -32,6 +33,16 @@ final class PHUIApplicationMenuView extends Phobject {
|
||||||
return $this->addItem($item);
|
return $this->addItem($item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setProfileMenu(
|
||||||
|
AphrontSideNavFilterView $nav) {
|
||||||
|
$this->profileMenu = $nav;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getProfileMenu() {
|
||||||
|
return $this->profileMenu;
|
||||||
|
}
|
||||||
|
|
||||||
public function addItem(PHUIListItemView $item) {
|
public function addItem(PHUIListItemView $item) {
|
||||||
$this->items[] = $item;
|
$this->items[] = $item;
|
||||||
return $this;
|
return $this;
|
||||||
|
@ -61,6 +72,15 @@ final class PHUIApplicationMenuView extends Phobject {
|
||||||
$view = id(new PHUIListView())
|
$view = id(new PHUIListView())
|
||||||
->setUser($viewer);
|
->setUser($viewer);
|
||||||
|
|
||||||
|
$profile_menu = $this->getProfileMenu();
|
||||||
|
if ($profile_menu) {
|
||||||
|
foreach ($profile_menu->getMenu()->getItems() as $item) {
|
||||||
|
$item = clone $item;
|
||||||
|
$item->setRenderNameAsTooltip(false);
|
||||||
|
$view->addMenuItem($item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$crumbs = $this->getCrumbs();
|
$crumbs = $this->getCrumbs();
|
||||||
if ($crumbs) {
|
if ($crumbs) {
|
||||||
$actions = $crumbs->getActions();
|
$actions = $crumbs->getActions();
|
||||||
|
|
Loading…
Reference in a new issue