From 5092bcf533a5998cd171a7a0f246c9df41c960b0 Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 5 Feb 2016 12:17:35 -0800 Subject: [PATCH] Fix dead column link and provide more milestone UI context Summary: Fixes T10287. Ref T10286. - Link stuff properly. - Generally, show "Parent (Milestone)" instead of "Milestone". - This probably doesn't get 100% of `getName()` -> `getDisplayName()` swaps, but we can get those as we catch them. Test Plan: See T10286. Also clicked stuff. Reviewers: chad Reviewed By: chad Maniphest Tasks: T10286, T10287 Differential Revision: https://secure.phabricator.com/D15189 --- .../PhabricatorProjectBoardViewController.php | 8 ++++++-- .../PhabricatorProjectManageController.php | 6 +++++- .../PhabricatorProjectMembersViewController.php | 2 +- .../PhabricatorProjectProfileController.php | 2 +- .../events/PhabricatorProjectUIEventListener.php | 4 +++- .../phid/PhabricatorProjectProjectPHIDType.php | 2 +- .../project/storage/PhabricatorProject.php | 14 ++++++++++++++ .../typeahead/PhabricatorProjectDatasource.php | 4 ++-- 8 files changed, 33 insertions(+), 9 deletions(-) diff --git a/src/applications/project/controller/PhabricatorProjectBoardViewController.php b/src/applications/project/controller/PhabricatorProjectBoardViewController.php index 396fb15999..d0580a95ad 100644 --- a/src/applications/project/controller/PhabricatorProjectBoardViewController.php +++ b/src/applications/project/controller/PhabricatorProjectBoardViewController.php @@ -149,8 +149,8 @@ final class PhabricatorProjectBoardViewController return $this->newPage() ->setTitle( array( + $project->getDisplayName(), pht('Workboard'), - $project->getName(), )) ->setNavigation($nav) ->setCrumbs($crumbs) @@ -371,7 +371,11 @@ final class PhabricatorProjectBoardViewController $crumbs->addAction($manage_menu); return $this->newPage() - ->setTitle(pht('%s Board', $project->getName())) + ->setTitle( + array( + $project->getDisplayName(), + pht('Workboard'), + )) ->setPageObjectPHIDs(array($project->getPHID())) ->setShowFooter(false) ->setNavigation($nav) diff --git a/src/applications/project/controller/PhabricatorProjectManageController.php b/src/applications/project/controller/PhabricatorProjectManageController.php index 2721265493..87420d1aa3 100644 --- a/src/applications/project/controller/PhabricatorProjectManageController.php +++ b/src/applications/project/controller/PhabricatorProjectManageController.php @@ -51,7 +51,11 @@ final class PhabricatorProjectManageController return $this->newPage() ->setNavigation($nav) ->setCrumbs($crumbs) - ->setTitle($project->getName()) + ->setTitle( + array( + $project->getDisplayName(), + pht('Manage'), + )) ->appendChild( array( $object_box, diff --git a/src/applications/project/controller/PhabricatorProjectMembersViewController.php b/src/applications/project/controller/PhabricatorProjectMembersViewController.php index efe2106a26..88bc56be24 100644 --- a/src/applications/project/controller/PhabricatorProjectMembersViewController.php +++ b/src/applications/project/controller/PhabricatorProjectMembersViewController.php @@ -48,7 +48,7 @@ final class PhabricatorProjectMembersViewController return $this->newPage() ->setNavigation($nav) ->setCrumbs($crumbs) - ->setTitle(array($project->getName(), $title)) + ->setTitle(array($project->getDisplayName(), $title)) ->appendChild( array( $object_box, diff --git a/src/applications/project/controller/PhabricatorProjectProfileController.php b/src/applications/project/controller/PhabricatorProjectProfileController.php index 8bd03b7053..7e5f066607 100644 --- a/src/applications/project/controller/PhabricatorProjectProfileController.php +++ b/src/applications/project/controller/PhabricatorProjectProfileController.php @@ -115,7 +115,7 @@ final class PhabricatorProjectProfileController return $this->newPage() ->setNavigation($nav) ->setCrumbs($crumbs) - ->setTitle($project->getName()) + ->setTitle($project->getDisplayName()) ->setPageObjectPHIDs(array($project->getPHID())) ->appendChild( array( diff --git a/src/applications/project/events/PhabricatorProjectUIEventListener.php b/src/applications/project/events/PhabricatorProjectUIEventListener.php index c85c036f51..afbc0aab4e 100644 --- a/src/applications/project/events/PhabricatorProjectUIEventListener.php +++ b/src/applications/project/events/PhabricatorProjectUIEventListener.php @@ -67,11 +67,13 @@ final class PhabricatorProjectUIEventListener $annotation = array(); foreach ($columns as $column) { + $project_id = $column->getProject()->getID(); + $column_name = pht('(%s)', $column->getDisplayName()); $column_link = phutil_tag( 'a', array( - 'href' => $handle->getURI().'board/', + 'href' => "/project/board/{$project_id}/", 'class' => 'maniphest-board-link', ), $column_name); diff --git a/src/applications/project/phid/PhabricatorProjectProjectPHIDType.php b/src/applications/project/phid/PhabricatorProjectProjectPHIDType.php index b9fdefc6b3..7a04103a7c 100644 --- a/src/applications/project/phid/PhabricatorProjectProjectPHIDType.php +++ b/src/applications/project/phid/PhabricatorProjectProjectPHIDType.php @@ -37,7 +37,7 @@ final class PhabricatorProjectProjectPHIDType extends PhabricatorPHIDType { foreach ($handles as $phid => $handle) { $project = $objects[$phid]; - $name = $project->getName(); + $name = $project->getDisplayName(); $id = $project->getID(); $slug = $project->getPrimarySlug(); diff --git a/src/applications/project/storage/PhabricatorProject.php b/src/applications/project/storage/PhabricatorProject.php index b3d23a089e..ad7fb525c0 100644 --- a/src/applications/project/storage/PhabricatorProject.php +++ b/src/applications/project/storage/PhabricatorProject.php @@ -490,6 +490,20 @@ final class PhabricatorProject extends PhabricatorProjectDAO return $number; } + public function getDisplayName() { + $name = $this->getName(); + + // If this is a milestone, show it as "Parent > Sprint 99". + if ($this->isMilestone()) { + $name = pht( + '%s (%s)', + $this->getParentProject()->getName(), + $name); + } + + return $name; + } + public function getDisplayIconKey() { if ($this->isMilestone()) { $key = PhabricatorProjectIconSet::getMilestoneIconKey(); diff --git a/src/applications/project/typeahead/PhabricatorProjectDatasource.php b/src/applications/project/typeahead/PhabricatorProjectDatasource.php index cc0140878f..d902c9c392 100644 --- a/src/applications/project/typeahead/PhabricatorProjectDatasource.php +++ b/src/applications/project/typeahead/PhabricatorProjectDatasource.php @@ -64,12 +64,12 @@ final class PhabricatorProjectDatasource } $all_strings = mpull($proj->getSlugs(), 'getSlug'); - $all_strings[] = $proj->getName(); + $all_strings[] = $proj->getDisplayName(); $all_strings = implode(' ', $all_strings); $proj_result = id(new PhabricatorTypeaheadResult()) ->setName($all_strings) - ->setDisplayName($proj->getName()) + ->setDisplayName($proj->getDisplayName()) ->setDisplayType(pht('Project')) ->setURI($proj->getURI()) ->setPHID($proj->getPHID())