1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 08:52:39 +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:
epriestley 2016-01-12 14:15:59 -08:00
parent 7bde92b9c9
commit 102eacbfb7
13 changed files with 85 additions and 86 deletions

View file

@ -3,11 +3,12 @@
abstract class PhabricatorProjectBoardController
extends PhabricatorProjectController {
public function buildIconNavView(PhabricatorProject $project) {
$id = $project->getID();
$nav = parent::buildIconNavView($project);
$nav->selectFilter(PhabricatorProject::PANEL_WORKBOARD);
$nav->addClass('project-board-nav');
return $nav;
protected function getProfileMenu() {
$menu = parent::getProfileMenu();
$menu->selectFilter(PhabricatorProject::PANEL_WORKBOARD);
$menu->addClass('project-board-nav');
return $menu;
}
}

View file

@ -384,7 +384,7 @@ final class PhabricatorProjectBoardViewController
->appendChild($board)
->addClass('project-board-wrapper');
$nav = $this->buildIconNavView($project);
$nav = $this->getProfileMenu();
return $this->newPage()
->setTitle(pht('%s Board', $project->getName()))

View file

@ -49,15 +49,16 @@ final class PhabricatorProjectColumnDetailController
->setHeader($header)
->addPropertyList($properties);
$nav = $this->buildIconNavView($project);
$nav->appendChild($box);
$nav->appendChild($timeline);
$nav = $this->getProfileMenu();
return $this->buildApplicationPage(
$nav,
array(
'title' => $title,
));
return $this->newPage()
->setTitle($title)
->setNavigation($nav)
->appendChild(
array(
$box,
$timeline,
));
}
private function buildHeaderView(PhabricatorProjectColumn $column) {

View file

@ -144,13 +144,11 @@ final class PhabricatorProjectColumnEditController
->setValidationException($validation_exception)
->setForm($form);
$nav = $this->buildIconNavView($project);
$nav->appendChild($form_box);
$nav = $this->getProfileMenu();
return $this->buildApplicationPage(
$nav,
array(
'title' => $title,
));
return $this->newPage()
->setTitle($title)
->setNavigation($nav)
->appendChild($form_box);
}
}

View file

@ -3,6 +3,7 @@
abstract class PhabricatorProjectController extends PhabricatorController {
private $project;
private $profileMenu;
protected function setProject(PhabricatorProject $project) {
$this->project = $project;
@ -80,50 +81,33 @@ abstract class PhabricatorProjectController extends PhabricatorController {
}
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) {
$project = $this->getProject();
$nav = new AphrontSideNavFilterView();
$nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
$viewer = $this->getViewer();
$id = null;
if ($for_app) {
protected function getProfileMenu() {
if (!$this->profileMenu) {
$project = $this->getProject();
if ($project) {
$id = $project->getID();
$nav->addFilter("profile/{$id}/", pht('Profile'));
$nav->addFilter("board/{$id}/", pht('Workboard'));
$nav->addFilter("members/{$id}/", pht('Members'));
$nav->addFilter("feed/{$id}/", pht('Feed'));
$viewer = $this->getViewer();
$engine = id(new PhabricatorProfilePanelEngine())
->setViewer($viewer)
->setProfileObject($project);
$this->profileMenu = $engine->buildNavigation();
}
$nav->addFilter('create', pht('Create Project'));
}
if (!$id) {
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();
return $this->profileMenu;
}
protected function buildApplicationCrumbs() {

View file

@ -21,6 +21,8 @@ final class PhabricatorProjectEditPictureController
return new Aphront404Response();
}
$this->setProject($project);
$edit_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'))
->setForm($upload_form);
$nav = $this->buildIconNavView($project);
$nav = $this->getProfileMenu();
$nav->selectFilter(PhabricatorProject::PANEL_PROFILE);
$nav->appendChild($form_box);
$nav->appendChild($upload_box);
return $this->buildApplicationPage(
$nav,
array(
'title' => $title,
));
return $this->newPage()
->setTitle($title)
->setNavigation($nav)
->appendChild(
array(
$form_box,
$upload_box,
));
}
}

View file

@ -33,7 +33,7 @@ final class PhabricatorProjectFeedController
->setHeaderText(pht('Project Activity'))
->appendChild($feed);
$nav = $this->buildIconNavView($project);
$nav = $this->getProfileMenu();
$nav->selectFilter('feed');
$crumbs = $this->buildApplicationCrumbs();

View file

@ -8,19 +8,9 @@ final class PhabricatorProjectListController
}
public function handleRequest(AphrontRequest $request) {
$viewer = $request->getViewer();
$query_key = $request->getURIData('queryKey');
$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();
return id(new PhabricatorProjectSearchEngine())
->setController($this)
->buildResponse();
}
protected function buildApplicationCrumbs() {

View file

@ -17,6 +17,8 @@ final class PhabricatorProjectMembersEditController
return new Aphront404Response();
}
$this->setProject($project);
$member_phids = $project->getMemberPHIDs();
if ($request->isFormPost()) {
@ -95,7 +97,7 @@ final class PhabricatorProjectMembersEditController
$member_list = $this->renderMemberList($project, $handles);
$nav = $this->buildIconNavView($project);
$nav = $this->getProfileMenu();
$nav->selectFilter(PhabricatorProject::PANEL_MEMBERS);
$crumbs = $this->buildApplicationCrumbs();

View file

@ -76,7 +76,7 @@ final class PhabricatorProjectMilestonesController
->setProjects($milestones)
->renderList());
$nav = $this->buildIconNavView($project);
$nav = $this->getProfileMenu();
$nav->selectFilter(PhabricatorProject::PANEL_MILESTONES);
$crumbs = $this->buildApplicationCrumbs();

View file

@ -43,7 +43,7 @@ final class PhabricatorProjectProfileController
new PhabricatorProjectTransactionQuery());
$timeline->setShouldTerminate(true);
$nav = $this->buildIconNavView($project);
$nav = $this->getProfileMenu();
$nav->selectFilter(PhabricatorProject::PANEL_PROFILE);
$crumbs = $this->buildApplicationCrumbs();

View file

@ -75,7 +75,7 @@ final class PhabricatorProjectSubprojectsController
->setProjects($subprojects)
->renderList());
$nav = $this->buildIconNavView($project);
$nav = $this->getProfileMenu();
$nav->selectFilter(PhabricatorProject::PANEL_SUBPROJECTS);
$crumbs = $this->buildApplicationCrumbs();

View file

@ -5,6 +5,7 @@ final class PHUIApplicationMenuView extends Phobject {
private $viewer;
private $crumbs;
private $searchEngine;
private $profileMenu;
private $items = array();
@ -32,6 +33,16 @@ final class PHUIApplicationMenuView extends Phobject {
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) {
$this->items[] = $item;
return $this;
@ -61,6 +72,15 @@ final class PHUIApplicationMenuView extends Phobject {
$view = id(new PHUIListView())
->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();
if ($crumbs) {
$actions = $crumbs->getActions();