1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-22 23:02:42 +01:00

On workboards, link ancestor project breadcrumbs to their workboards

Summary:
Ref T13269. Currently, if you're on a milestone workboard like this:

> Projects > Parent > Milestone > Workboard

The "Parent" link goes to the parent profile. More often, I want it to go to the parent workboard. Try doing that? This is kind of one-off but I suspect it's a better rule.

Also, consolidate one billion manual constructions of "/board/" URIs.

Test Plan: Viewed a milestone workboard, clicked the parent link, ended up on the parent workboard.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13269

Differential Revision: https://secure.phabricator.com/D20331
This commit is contained in:
epriestley 2019-03-26 16:30:32 -07:00
parent 4485482fd4
commit ee54e71ba9
17 changed files with 47 additions and 25 deletions

View file

@ -243,8 +243,7 @@ final class ManiphestTransactionEditor
foreach ($projects as $project) {
$body->addLinkSection(
pht('WORKBOARD'),
PhabricatorEnv::getProductionURI(
'/project/board/'.$project->getID().'/'));
PhabricatorEnv::getProductionURI($project->getWorkboardURI()));
}
}

View file

@ -55,7 +55,7 @@ final class PhabricatorProjectBoardBackgroundController
$nav = $this->getProfileMenu();
$crumbs = id($this->buildApplicationCrumbs())
->addTextCrumb(pht('Workboard'), "/project/board/{$board_id}/")
->addTextCrumb(pht('Workboard'), $board->getWorkboardURI())
->addTextCrumb(pht('Manage'), $manage_uri)
->addTextCrumb(pht('Background Color'));

View file

@ -34,7 +34,7 @@ final class PhabricatorProjectBoardManageController
$curtain = $this->buildCurtainView($board);
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb(pht('Workboard'), "/project/board/{$board_id}/");
$crumbs->addTextCrumb(pht('Workboard'), $board->getWorkboardURI());
$crumbs->addTextCrumb(pht('Manage'));
$crumbs->setBorder(true);

View file

@ -726,7 +726,7 @@ final class PhabricatorProjectBoardViewController
->setType(PHUIListItemView::TYPE_DIVIDER);
$fullscreen = $this->buildFullscreenMenu();
$crumbs = $this->buildApplicationCrumbs();
$crumbs = $this->newWorkboardCrumbs();
$crumbs->addTextCrumb(pht('Workboard'));
$crumbs->setBorder(true);

View file

@ -47,7 +47,7 @@ final class PhabricatorProjectColumnDetailController
$properties = $this->buildPropertyView($column);
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb(pht('Workboard'), "/project/board/{$project_id}/");
$crumbs->addTextCrumb(pht('Workboard'), $project->getWorkboardURI());
$crumbs->addTextCrumb(pht('Column: %s', $title));
$crumbs->setBorder(true);

View file

@ -50,8 +50,7 @@ final class PhabricatorProjectColumnEditController
$v_name = $column->getName();
$validation_exception = null;
$base_uri = '/board/'.$project_id.'/';
$view_uri = $this->getApplicationURI($base_uri);
$view_uri = $project->getWorkboardURI();
if ($request->isFormPost()) {
$v_name = $request->getStr('name');

View file

@ -38,7 +38,7 @@ final class PhabricatorProjectColumnHideController
$column_phid = $column->getPHID();
$view_uri = $this->getApplicationURI('/board/'.$project_id.'/');
$view_uri = $project->getWorkboardURI();
$view_uri = new PhutilURI($view_uri);
foreach ($request->getPassthroughRequestData() as $key => $value) {
$view_uri->replaceQueryParam($key, $value);

View file

@ -20,7 +20,7 @@ final class PhabricatorProjectColumnRemoveTriggerController
return new Aphront404Response();
}
$done_uri = $column->getBoardURI();
$done_uri = $column->getWorkboardURI();
if (!$column->getTriggerPHID()) {
return $this->newDialog()

View file

@ -109,6 +109,14 @@ abstract class PhabricatorProjectController extends PhabricatorController {
}
protected function buildApplicationCrumbs() {
return $this->newApplicationCrumbs('profile');
}
protected function newWorkboardCrumbs() {
return $this->newApplicationCrumbs('workboard');
}
private function newApplicationCrumbs($mode) {
$crumbs = parent::buildApplicationCrumbs();
$project = $this->getProject();
@ -117,10 +125,24 @@ abstract class PhabricatorProjectController extends PhabricatorController {
$ancestors = array_reverse($ancestors);
$ancestors[] = $project;
foreach ($ancestors as $ancestor) {
$crumbs->addTextCrumb(
$ancestor->getName(),
$ancestor->getProfileURI()
);
if ($ancestor->getPHID() === $project->getPHID()) {
// Link the current project's crumb to its profile no matter what,
// since we're already on the right context page for it and linking
// to the current page isn't helpful.
$crumb_uri = $ancestor->getProfileURI();
} else {
switch ($mode) {
case 'workboard':
$crumb_uri = $ancestor->getWorkboardURI();
break;
case 'profile':
default:
$crumb_uri = $ancestor->getProfileURI();
break;
}
}
$crumbs->addTextCrumb($ancestor->getName(), $crumb_uri);
}
}

View file

@ -39,7 +39,7 @@ final class PhabricatorProjectTriggerEditController
if (!$column) {
return new Aphront404Response();
}
$board_uri = $column->getBoardURI();
$board_uri = $column->getWorkboardURI();
} else {
$column = null;
$board_uri = null;
@ -122,7 +122,7 @@ final class PhabricatorProjectTriggerEditController
$column_editor->applyTransactions($column, $column_xactions);
$next_uri = $column->getBoardURI();
$next_uri = $column->getWorkboardURI();
}
return id(new AphrontRedirectResponse())->setURI($next_uri);

View file

@ -111,7 +111,7 @@ final class PhabricatorProjectTriggerViewController
$column_name = phutil_tag(
'a',
array(
'href' => $column->getBoardURI(),
'href' => $column->getWorkboardURI(),
),
$column->getDisplayName());
} else {

View file

@ -55,7 +55,7 @@ final class PhabricatorProjectsCurtainExtension
$column_link = phutil_tag(
'a',
array(
'href' => "/project/board/{$project_id}/",
'href' => $column->getWorkboardURI(),
'class' => 'maniphest-board-link',
),
$column_name);

View file

@ -81,7 +81,7 @@ final class PhabricatorProjectUIEventListener
$column_link = phutil_tag(
'a',
array(
'href' => "/project/board/{$project_id}/",
'href' => $column->getWorkboardURI(),
'class' => 'maniphest-board-link',
),
$column_name);

View file

@ -57,7 +57,7 @@ final class PhabricatorProjectWorkboardProfileMenuItem
$project = $config->getProfileObject();
$id = $project->getID();
$href = "/project/board/{$id}/";
$href = $project->getWorkboardURI();
$name = $this->getDisplayName($config);
$item = $this->newItem()

View file

@ -37,7 +37,7 @@ final class PhabricatorProjectColumnPHIDType extends PhabricatorPHIDType {
$column = $objects[$phid];
$handle->setName($column->getDisplayName());
$handle->setURI('/project/board/'.$column->getProject()->getID().'/');
$handle->setURI($column->getWorkboardURI());
if ($column->isHidden()) {
$handle->setStatus(PhabricatorObjectHandle::STATUS_CLOSED);

View file

@ -392,6 +392,10 @@ final class PhabricatorProject extends PhabricatorProjectDAO
return "/project/profile/{$id}/";
}
public function getWorkboardURI() {
return urisprintf('/project/board/%d/', $this->getID());
}
public function save() {
if (!$this->getMailKey()) {
$this->setMailKey(Filesystem::readRandomCharacters(20));

View file

@ -212,10 +212,8 @@ final class PhabricatorProjectColumn
return true;
}
public function getBoardURI() {
return urisprintf(
'/project/board/%d/',
$this->getProject()->getID());
public function getWorkboardURI() {
return $this->getProject()->getWorkboardURI();
}
public function getDropEffects() {