From d8e3f2edf223dbffd51d36b67ce6ca07ed964e1e Mon Sep 17 00:00:00 2001 From: epriestley Date: Thu, 4 Sep 2014 12:47:32 -0700 Subject: [PATCH] Move column hide/show to the column context menu on workboards Summary: Fixes T5993. Now that we have a context menu we can make some edit operations easier to access. Test Plan: Toggled column visibility. Verified board state (columns shown/hidden, ordering) was retained. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T5993 Differential Revision: https://secure.phabricator.com/D10417 --- src/__phutil_library_map__.php | 4 ++-- .../PhabricatorProjectApplication.php | 4 ++-- .../PhabricatorProjectBoardViewController.php | 21 +++++++++++++++++++ ...abricatorProjectColumnDetailController.php | 20 ------------------ ...habricatorProjectColumnHideController.php} | 14 ++++++++++--- 5 files changed, 36 insertions(+), 27 deletions(-) rename src/applications/project/controller/{PhabricatorProjectBoardDeleteController.php => PhabricatorProjectColumnHideController.php} (87%) diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index c0ce4d8ee1..bc84bd3cfc 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -1940,13 +1940,13 @@ phutil_register_library_map(array( 'PhabricatorProjectApplication' => 'applications/project/application/PhabricatorProjectApplication.php', 'PhabricatorProjectArchiveController' => 'applications/project/controller/PhabricatorProjectArchiveController.php', 'PhabricatorProjectBoardController' => 'applications/project/controller/PhabricatorProjectBoardController.php', - 'PhabricatorProjectBoardDeleteController' => 'applications/project/controller/PhabricatorProjectBoardDeleteController.php', 'PhabricatorProjectBoardImportController' => 'applications/project/controller/PhabricatorProjectBoardImportController.php', 'PhabricatorProjectBoardReorderController' => 'applications/project/controller/PhabricatorProjectBoardReorderController.php', 'PhabricatorProjectBoardViewController' => 'applications/project/controller/PhabricatorProjectBoardViewController.php', 'PhabricatorProjectColumn' => 'applications/project/storage/PhabricatorProjectColumn.php', 'PhabricatorProjectColumnDetailController' => 'applications/project/controller/PhabricatorProjectColumnDetailController.php', 'PhabricatorProjectColumnEditController' => 'applications/project/controller/PhabricatorProjectColumnEditController.php', + 'PhabricatorProjectColumnHideController' => 'applications/project/controller/PhabricatorProjectColumnHideController.php', 'PhabricatorProjectColumnPHIDType' => 'applications/project/phid/PhabricatorProjectColumnPHIDType.php', 'PhabricatorProjectColumnPosition' => 'applications/project/storage/PhabricatorProjectColumnPosition.php', 'PhabricatorProjectColumnPositionQuery' => 'applications/project/query/PhabricatorProjectColumnPositionQuery.php', @@ -4800,7 +4800,6 @@ phutil_register_library_map(array( 'PhabricatorProjectApplication' => 'PhabricatorApplication', 'PhabricatorProjectArchiveController' => 'PhabricatorProjectController', 'PhabricatorProjectBoardController' => 'PhabricatorProjectController', - 'PhabricatorProjectBoardDeleteController' => 'PhabricatorProjectBoardController', 'PhabricatorProjectBoardImportController' => 'PhabricatorProjectBoardController', 'PhabricatorProjectBoardReorderController' => 'PhabricatorProjectBoardController', 'PhabricatorProjectBoardViewController' => 'PhabricatorProjectBoardController', @@ -4811,6 +4810,7 @@ phutil_register_library_map(array( ), 'PhabricatorProjectColumnDetailController' => 'PhabricatorProjectBoardController', 'PhabricatorProjectColumnEditController' => 'PhabricatorProjectBoardController', + 'PhabricatorProjectColumnHideController' => 'PhabricatorProjectBoardController', 'PhabricatorProjectColumnPHIDType' => 'PhabricatorPHIDType', 'PhabricatorProjectColumnPosition' => array( 'PhabricatorProjectDAO', diff --git a/src/applications/project/application/PhabricatorProjectApplication.php b/src/applications/project/application/PhabricatorProjectApplication.php index 059113acc6..3001c7be24 100644 --- a/src/applications/project/application/PhabricatorProjectApplication.php +++ b/src/applications/project/application/PhabricatorProjectApplication.php @@ -67,8 +67,8 @@ final class PhabricatorProjectApplication extends PhabricatorApplication { 'board/(?P[1-9]\d*)/' => array( 'edit/(?:(?P\d+)/)?' => 'PhabricatorProjectColumnEditController', - 'delete/(?:(?P\d+)/)?' - => 'PhabricatorProjectBoardDeleteController', + 'hide/(?:(?P\d+)/)?' + => 'PhabricatorProjectColumnHideController', 'column/(?:(?P\d+)/)?' => 'PhabricatorProjectColumnDetailController', 'import/' diff --git a/src/applications/project/controller/PhabricatorProjectBoardViewController.php b/src/applications/project/controller/PhabricatorProjectBoardViewController.php index 00c5f5065d..25519a368e 100644 --- a/src/applications/project/controller/PhabricatorProjectBoardViewController.php +++ b/src/applications/project/controller/PhabricatorProjectBoardViewController.php @@ -562,6 +562,27 @@ final class PhabricatorProjectBoardViewController ->setDisabled(!$can_edit) ->setWorkflow(!$can_edit); + $can_hide = ($can_edit && !$column->isDefaultColumn()); + $hide_uri = 'board/'.$this->id.'/hide/'.$column->getID().'/'; + $hide_uri = $this->getApplicationURI($hide_uri); + $hide_uri = $this->getURIWithState($hide_uri); + + if (!$column->isHidden()) { + $column_items[] = id(new PhabricatorActionView()) + ->setName(pht('Hide Column')) + ->setIcon('fa-eye-slash') + ->setHref($hide_uri) + ->setDisabled(!$can_hide) + ->setWorkflow(true); + } else { + $column_items[] = id(new PhabricatorActionView()) + ->setName(pht('Show Column')) + ->setIcon('fa-eye') + ->setHref($hide_uri) + ->setDisabled(!$can_hide) + ->setWorkflow(true); + } + $column_menu = id(new PhabricatorActionListView()) ->setUser($viewer); foreach ($column_items as $item) { diff --git a/src/applications/project/controller/PhabricatorProjectColumnDetailController.php b/src/applications/project/controller/PhabricatorProjectColumnDetailController.php index 7c7c05bab2..7f6b62b26a 100644 --- a/src/applications/project/controller/PhabricatorProjectColumnDetailController.php +++ b/src/applications/project/controller/PhabricatorProjectColumnDetailController.php @@ -119,26 +119,6 @@ final class PhabricatorProjectColumnDetailController ->setDisabled(!$can_edit) ->setWorkflow(!$can_edit)); - $can_hide = ($can_edit && !$column->isDefaultColumn()); - - if (!$column->isHidden()) { - $actions->addAction( - id(new PhabricatorActionView()) - ->setName(pht('Hide Column')) - ->setIcon('fa-eye-slash') - ->setHref($this->getApplicationURI($base_uri.'delete/'.$id.'/')) - ->setDisabled(!$can_hide) - ->setWorkflow(true)); - } else { - $actions->addAction( - id(new PhabricatorActionView()) - ->setName(pht('Show Column')) - ->setIcon('fa-eye') - ->setHref($this->getApplicationURI($base_uri.'delete/'.$id.'/')) - ->setDisabled(!$can_hide) - ->setWorkflow(true)); - } - return $actions; } diff --git a/src/applications/project/controller/PhabricatorProjectBoardDeleteController.php b/src/applications/project/controller/PhabricatorProjectColumnHideController.php similarity index 87% rename from src/applications/project/controller/PhabricatorProjectBoardDeleteController.php rename to src/applications/project/controller/PhabricatorProjectColumnHideController.php index 019bc65228..782b1c8ae9 100644 --- a/src/applications/project/controller/PhabricatorProjectBoardDeleteController.php +++ b/src/applications/project/controller/PhabricatorProjectColumnHideController.php @@ -1,6 +1,6 @@ getPHID(); - $view_uri = $this->getApplicationURI( - '/board/'.$this->projectID.'/column/'.$this->id.'/'); + + $view_uri = $this->getApplicationURI('/board/'.$this->projectID.'/'); + $view_uri = new PhutilURI($view_uri); + foreach ($request->getPassthroughRequestData() as $key => $value) { + $view_uri->setQueryParam($key, $value); + } if ($column->isDefaultColumn()) { return $this->newDialog() @@ -97,6 +101,10 @@ final class PhabricatorProjectBoardDeleteController ->addCancelButton($view_uri) ->addSubmitButton($title); + foreach ($request->getPassthroughRequestData() as $key => $value) { + $dialog->addHiddenInput($key, $value); + } + return $dialog; } }