From 3f180496e591cd3dc4a750394f4616d7541aec00 Mon Sep 17 00:00:00 2001 From: epriestley Date: Sun, 12 Jan 2014 21:39:50 -0800 Subject: [PATCH] Straighten out some crumbs and links for workboards Summary: Ref T1344. Minor tweaks for crumb/link stuff -- @mikn has been doing some work here recently and I want to unblock him. Test Plan: Viewed board; viewed column edit screen. Reviewers: chad, btrahan Reviewed By: chad CC: mikn, aran Maniphest Tasks: T1344 Differential Revision: https://secure.phabricator.com/D7937 --- .../PhabricatorProjectBoardController.php | 13 ++++++++++++- .../PhabricatorProjectBoardEditController.php | 6 ++++++ .../controller/PhabricatorProjectController.php | 17 ----------------- .../PhabricatorProjectListController.php | 17 +++++++++++++++++ 4 files changed, 35 insertions(+), 18 deletions(-) diff --git a/src/applications/project/controller/PhabricatorProjectBoardController.php b/src/applications/project/controller/PhabricatorProjectBoardController.php index e93bda71fd..5a5b0422ee 100644 --- a/src/applications/project/controller/PhabricatorProjectBoardController.php +++ b/src/applications/project/controller/PhabricatorProjectBoardController.php @@ -74,6 +74,15 @@ final class PhabricatorProjectBoardController } $crumbs = $this->buildApplicationCrumbs(); + $crumbs->addTextCrumb( + $project->getName(), + $this->getApplicationURI('view/'.$project->getID().'/')); + $crumbs->addTextCrumb(pht('Board')); + + $can_edit = PhabricatorPolicyFilter::hasCapability( + $viewer, + $project, + PhabricatorPolicyCapability::CAN_EDIT); $actions = id(new PhabricatorActionListView()) ->setUser($viewer) @@ -81,7 +90,9 @@ final class PhabricatorProjectBoardController id(new PhabricatorActionView()) ->setName(pht('Add Column/Milestone/Sprint')) ->setHref($this->getApplicationURI('board/'.$this->id.'/edit/')) - ->setIcon('create')); + ->setIcon('create') + ->setDisabled(!$can_edit) + ->setWorkflow(!$can_edit)); $plist = id(new PHUIPropertyListView()); // TODO: Need this to get actions to render. diff --git a/src/applications/project/controller/PhabricatorProjectBoardEditController.php b/src/applications/project/controller/PhabricatorProjectBoardEditController.php index f9cea6169f..266609e259 100644 --- a/src/applications/project/controller/PhabricatorProjectBoardEditController.php +++ b/src/applications/project/controller/PhabricatorProjectBoardEditController.php @@ -112,6 +112,12 @@ final class PhabricatorProjectBoardEditController ->addCancelButton($view_uri)); $crumbs = $this->buildApplicationCrumbs(); + $crumbs->addTextCrumb( + $project->getName(), + $this->getApplicationURI('view/'.$project->getID().'/')); + $crumbs->addTextCrumb( + pht('Board'), + $this->getApplicationURI('board/'.$project->getID().'/')); $crumbs->addTextCrumb($title); $form_box = id(new PHUIObjectBoxView()) diff --git a/src/applications/project/controller/PhabricatorProjectController.php b/src/applications/project/controller/PhabricatorProjectController.php index a50d0afedf..02a6fd1d45 100644 --- a/src/applications/project/controller/PhabricatorProjectController.php +++ b/src/applications/project/controller/PhabricatorProjectController.php @@ -21,21 +21,4 @@ abstract class PhabricatorProjectController extends PhabricatorController { return $nav; } - public function buildApplicationCrumbs() { - $crumbs = parent::buildApplicationCrumbs(); - - $can_create = $this->hasApplicationCapability( - ProjectCapabilityCreateProjects::CAPABILITY); - - $crumbs->addAction( - id(new PHUIListItemView()) - ->setName(pht('Create Project')) - ->setHref($this->getApplicationURI('create/')) - ->setIcon('create') - ->setWorkflow(!$can_create) - ->setDisabled(!$can_create)); - - return $crumbs; - } - } diff --git a/src/applications/project/controller/PhabricatorProjectListController.php b/src/applications/project/controller/PhabricatorProjectListController.php index 81fdab8823..743375c4a7 100644 --- a/src/applications/project/controller/PhabricatorProjectListController.php +++ b/src/applications/project/controller/PhabricatorProjectListController.php @@ -51,4 +51,21 @@ final class PhabricatorProjectListController return $list; } + public function buildApplicationCrumbs() { + $crumbs = parent::buildApplicationCrumbs(); + + $can_create = $this->hasApplicationCapability( + ProjectCapabilityCreateProjects::CAPABILITY); + + $crumbs->addAction( + id(new PHUIListItemView()) + ->setName(pht('Create Project')) + ->setHref($this->getApplicationURI('create/')) + ->setIcon('create') + ->setWorkflow(!$can_create) + ->setDisabled(!$can_create)); + + return $crumbs; + } + }