Skip to content

Commit 2b5d4bc

Browse files
author
epriestley
committed
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
1 parent 5e715c1 commit 2b5d4bc

File tree

5 files changed

+44
-13
lines changed

5 files changed

+44
-13
lines changed

src/applications/project/controller/PhabricatorProjectController.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,4 +154,22 @@ public function buildIconNavView(PhabricatorProject $project) {
154154
return $nav;
155155
}
156156

157+
protected function buildApplicationCrumbs() {
158+
$crumbs = parent::buildApplicationCrumbs();
159+
160+
$project = $this->getProject();
161+
if ($project) {
162+
$ancestors = $project->getAncestorProjects();
163+
$ancestors = array_reverse($ancestors);
164+
$ancestors[] = $project;
165+
foreach ($ancestors as $ancestor) {
166+
$crumbs->addTextCrumb(
167+
$project->getName(),
168+
$project->getURI());
169+
}
170+
}
171+
172+
return $crumbs;
173+
}
174+
157175
}

src/applications/project/controller/PhabricatorProjectFeedController.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,14 @@ public function handleRequest(AphrontRequest $request) {
3737
$nav->selectFilter("feed/{$id}/");
3838
$nav->appendChild($box);
3939

40-
return $this->buildApplicationPage(
41-
$nav,
42-
array(
43-
'title' => $project->getName(),
44-
));
40+
$crumbs = $this->buildApplicationCrumbs();
41+
$crumbs->addTextCrumb(pht('Feed'));
42+
43+
return $this->newPage()
44+
->setNavigation($nav)
45+
->setCrumbs($crumbs)
46+
->setTitle(array($project->getName(), pht('Feed')))
47+
->appendChild($box);
4548
}
4649

4750
private function renderStories(array $stories) {

src/applications/project/controller/PhabricatorProjectMembersEditController.php

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,16 @@ public function handleRequest(AphrontRequest $request) {
9595

9696
$nav = $this->buildIconNavView($project);
9797
$nav->selectFilter("members/{$id}/");
98-
$nav->appendChild($form_box);
99-
$nav->appendChild($member_list);
100-
101-
return $this->buildApplicationPage(
102-
$nav,
103-
array(
104-
'title' => $title,
105-
));
98+
99+
$crumbs = $this->buildApplicationCrumbs();
100+
$crumbs->addTextCrumb(pht('Members'));
101+
102+
return $this->newPage()
103+
->setNavigation($nav)
104+
->setCrumbs($crumbs)
105+
->setTitle(array($project->getName(), $title))
106+
->appendChild($form_box)
107+
->appendChild($member_list);
106108
}
107109

108110
private function renderMemberList(

src/applications/project/controller/PhabricatorProjectProfileController.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,11 @@ public function handleRequest(AphrontRequest $request) {
4646
$nav = $this->buildIconNavView($project);
4747
$nav->selectFilter("profile/{$id}/");
4848

49+
$crumbs = $this->buildApplicationCrumbs();
50+
4951
return $this->newPage()
5052
->setNavigation($nav)
53+
->setCrumbs($crumbs)
5154
->setTitle($project->getName())
5255
->setPageObjectPHIDs(array($project->getPHID()))
5356
->appendChild($object_box)

src/applications/project/storage/PhabricatorProject.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,11 @@ public function getColor() {
308308
return $this->color;
309309
}
310310

311+
public function getURI() {
312+
$id = $this->getID();
313+
return "/project/view/{$id}/";
314+
}
315+
311316
public function save() {
312317
if (!$this->getMailKey()) {
313318
$this->setMailKey(Filesystem::readRandomCharacters(20));

0 commit comments

Comments
 (0)