1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-04-04 08:28:22 +02:00

Put some crumbs on some project pages

Summary: Ref T10010. This is primarily to make "Parent > Child > Grandchild" navigation more manageable for subprojects, at least for now.

Test Plan: Viewed profile, members, feed; saw crumbs.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T10010

Differential Revision: https://secure.phabricator.com/D14891
This commit is contained in:
epriestley 2015-12-27 04:10:59 -08:00
parent 5e715c1aca
commit 2b5d4bca8a
5 changed files with 43 additions and 12 deletions

View file

@ -154,4 +154,22 @@ abstract class PhabricatorProjectController extends PhabricatorController {
return $nav; return $nav;
} }
protected function buildApplicationCrumbs() {
$crumbs = parent::buildApplicationCrumbs();
$project = $this->getProject();
if ($project) {
$ancestors = $project->getAncestorProjects();
$ancestors = array_reverse($ancestors);
$ancestors[] = $project;
foreach ($ancestors as $ancestor) {
$crumbs->addTextCrumb(
$project->getName(),
$project->getURI());
}
}
return $crumbs;
}
} }

View file

@ -37,11 +37,14 @@ final class PhabricatorProjectFeedController
$nav->selectFilter("feed/{$id}/"); $nav->selectFilter("feed/{$id}/");
$nav->appendChild($box); $nav->appendChild($box);
return $this->buildApplicationPage( $crumbs = $this->buildApplicationCrumbs();
$nav, $crumbs->addTextCrumb(pht('Feed'));
array(
'title' => $project->getName(), return $this->newPage()
)); ->setNavigation($nav)
->setCrumbs($crumbs)
->setTitle(array($project->getName(), pht('Feed')))
->appendChild($box);
} }
private function renderStories(array $stories) { private function renderStories(array $stories) {

View file

@ -95,14 +95,16 @@ final class PhabricatorProjectMembersEditController
$nav = $this->buildIconNavView($project); $nav = $this->buildIconNavView($project);
$nav->selectFilter("members/{$id}/"); $nav->selectFilter("members/{$id}/");
$nav->appendChild($form_box);
$nav->appendChild($member_list);
return $this->buildApplicationPage( $crumbs = $this->buildApplicationCrumbs();
$nav, $crumbs->addTextCrumb(pht('Members'));
array(
'title' => $title, return $this->newPage()
)); ->setNavigation($nav)
->setCrumbs($crumbs)
->setTitle(array($project->getName(), $title))
->appendChild($form_box)
->appendChild($member_list);
} }
private function renderMemberList( private function renderMemberList(

View file

@ -46,8 +46,11 @@ final class PhabricatorProjectProfileController
$nav = $this->buildIconNavView($project); $nav = $this->buildIconNavView($project);
$nav->selectFilter("profile/{$id}/"); $nav->selectFilter("profile/{$id}/");
$crumbs = $this->buildApplicationCrumbs();
return $this->newPage() return $this->newPage()
->setNavigation($nav) ->setNavigation($nav)
->setCrumbs($crumbs)
->setTitle($project->getName()) ->setTitle($project->getName())
->setPageObjectPHIDs(array($project->getPHID())) ->setPageObjectPHIDs(array($project->getPHID()))
->appendChild($object_box) ->appendChild($object_box)

View file

@ -308,6 +308,11 @@ final class PhabricatorProject extends PhabricatorProjectDAO
return $this->color; return $this->color;
} }
public function getURI() {
$id = $this->getID();
return "/project/view/{$id}/";
}
public function save() { public function save() {
if (!$this->getMailKey()) { if (!$this->getMailKey()) {
$this->setMailKey(Filesystem::readRandomCharacters(20)); $this->setMailKey(Filesystem::readRandomCharacters(20));