diff --git a/src/applications/project/controller/PhabricatorProjectBoardDeleteController.php b/src/applications/project/controller/PhabricatorProjectBoardDeleteController.php --- a/src/applications/project/controller/PhabricatorProjectBoardDeleteController.php +++ b/src/applications/project/controller/PhabricatorProjectBoardDeleteController.php @@ -41,34 +41,16 @@ return new Aphront404Response(); } - $error_view = null; $column_phid = $column->getPHID(); - $has_task_phids = PhabricatorEdgeQuery::loadDestinationPHIDs( - $column_phid, - PhabricatorEdgeConfig::TYPE_COLUMN_HAS_OBJECT); - - if ($has_task_phids) { - $error_view = id(new AphrontErrorView()) - ->setTitle(pht('Column has Tasks!')); - if ($column->isDeleted()) { - $error_view->setErrors(array(pht( - 'A column can not be activated if it has tasks '. - 'in it. Please remove the tasks and try again.'))); - } else { - $error_view->setErrors(array(pht( - 'A column can not be deleted if it has tasks '. - 'in it. Please remove the tasks and try again.'))); - } - } $view_uri = $this->getApplicationURI( '/board/'.$this->projectID.'/column/'.$this->id.'/'); - if ($request->isFormPost() && !$error_view) { - if ($column->isDeleted()) { + if ($request->isFormPost()) { + if ($column->isHidden()) { $new_status = PhabricatorProjectColumn::STATUS_ACTIVE; } else { - $new_status = PhabricatorProjectColumn::STATUS_DELETED; + $new_status = PhabricatorProjectColumn::STATUS_HIDDEN; } $type_status = PhabricatorProjectColumnTransaction::TYPE_STATUS; @@ -85,31 +67,29 @@ return id(new AphrontRedirectResponse())->setURI($view_uri); } - if ($column->isDeleted()) { - $title = pht('Activate Column'); + if ($column->isHidden()) { + $title = pht('Show Column'); } else { - $title = pht('Delete Column'); + $title = pht('Hide Column'); } - $submit = $title; - if ($error_view) { - $body = $error_view; - } else if ($column->isDeleted()) { - $body = pht('Are you sure you want to activate this column?'); + + if ($column->isHidden()) { + $body = pht( + 'Are you sure you want to show this column?'); } else { - $body = pht('Are you sure you want to delete this column?'); + $body = pht( + 'Are you sure you want to hide this column? It will no longer '. + 'appear on the workboard.'); } - $dialog = id(new AphrontDialogView()) - ->setUser($viewer) + $dialog = $this->newDialog() ->setWidth(AphrontDialogView::WIDTH_FORM) ->setTitle($title) ->appendChild($body) ->setDisableWorkflowOnCancel(true) - ->addSubmitButton($title) - ->addCancelButton($view_uri); - - return id(new AphrontDialogResponse()) - ->setDialog($dialog); + ->addCancelButton($view_uri) + ->addSubmitButton($title); + return $dialog; } } diff --git a/src/applications/project/controller/PhabricatorProjectBoardViewController.php b/src/applications/project/controller/PhabricatorProjectBoardViewController.php --- a/src/applications/project/controller/PhabricatorProjectBoardViewController.php +++ b/src/applications/project/controller/PhabricatorProjectBoardViewController.php @@ -24,6 +24,8 @@ $request = $this->getRequest(); $viewer = $request->getUser(); + $show_hidden = $request->getBool('hidden'); + $project = id(new PhabricatorProjectQuery()) ->setViewer($viewer) ->needImages(true); @@ -39,12 +41,16 @@ $this->setProject($project); - $columns = id(new PhabricatorProjectColumnQuery()) + $column_query = id(new PhabricatorProjectColumnQuery()) ->setViewer($viewer) - ->withProjectPHIDs(array($project->getPHID())) - ->withStatuses(array(PhabricatorProjectColumn::STATUS_ACTIVE)) - ->execute(); + ->withProjectPHIDs(array($project->getPHID())); + + if (!$show_hidden) { + $column_query->withStatuses( + array(PhabricatorProjectColumn::STATUS_ACTIVE)); + } + $columns = $column_query->execute(); $columns = mpull($columns, null, 'getSequence'); // If there's no default column, create one now. @@ -168,9 +174,11 @@ $panel = id(new PHUIWorkpanelView()) ->setHeader($column->getDisplayName()) ->setHeaderColor($column->getHeaderColor()); + if (!$column->isDefaultColumn()) { $panel->setEditURI($board_uri.'column/'.$column->getID().'/'); } + $panel->setHeaderAction(id(new PHUIIconView()) ->setIconFont('fa-plus') ->setHref('/maniphest/task/create/') @@ -187,6 +195,7 @@ array( 'columnPHID' => $column->getPHID(), )); + $task_phids = idx($task_map, $column->getPHID(), array()); foreach (array_select_keys($tasks, $task_phids) as $task) { $owner = null; @@ -282,8 +291,6 @@ ->setWorkflow(true) ->setName(pht('Advanced Filter...')); - - $filter_menu = id(new PhabricatorActionListView()) ->setUser($viewer); foreach ($items as $item) { @@ -296,7 +303,6 @@ ->setTag('a') ->setHref('#') ->addSigil('boards-filter-menu') - ->setMetadata( array( 'items' => hsprintf('%s', $filter_menu), @@ -309,12 +315,33 @@ ), $project->getName()); + if ($show_hidden) { + $hidden_uri = $request->getRequestURI() + ->setQueryParam('hidden', null); + $hidden_icon = id(new PHUIIconView()) + ->setIconFont('fa-eye-slash bluegrey'); + $hidden_text = pht('Hide Hidden Columns'); + } else { + $hidden_uri = $request->getRequestURI() + ->setQueryParam('hidden', 'true'); + $hidden_icon = id(new PHUIIconView()) + ->setIconFont('fa-eye bluegrey'); + $hidden_text = pht('Show Hidden Columns'); + } + + $hidden_button = id(new PHUIButtonView()) + ->setText($hidden_text) + ->setIcon($hidden_icon) + ->setTag('a') + ->setHref($hidden_uri); + $header = id(new PHUIHeaderView()) ->setHeader($header_link) ->setUser($viewer) ->setNoBackground(true) ->setImage($project->getProfileImageURI()) ->setImageURL($this->getApplicationURI('view/'.$project->getID().'/')) + ->addActionLink($hidden_button) ->addActionLink($filter_button) ->addActionLink($add_button) ->setPolicyObject($project); diff --git a/src/applications/project/controller/PhabricatorProjectColumnDetailController.php b/src/applications/project/controller/PhabricatorProjectColumnDetailController.php --- a/src/applications/project/controller/PhabricatorProjectColumnDetailController.php +++ b/src/applications/project/controller/PhabricatorProjectColumnDetailController.php @@ -88,8 +88,8 @@ ->setHeader($column->getName()) ->setPolicyObject($column); - if ($column->isDeleted()) { - $header->setStatus('fa-ban', 'dark', pht('Deleted')); + if ($column->isHidden()) { + $header->setStatus('fa-ban', 'dark', pht('Hidden')); } return $header; @@ -113,25 +113,25 @@ $actions->addAction( id(new PhabricatorActionView()) - ->setName(pht('Edit column')) + ->setName(pht('Edit Column')) ->setIcon('fa-pencil') ->setHref($this->getApplicationURI($base_uri.'edit/'.$id.'/')) ->setDisabled(!$can_edit) ->setWorkflow(!$can_edit)); - if (!$column->isDeleted()) { + if (!$column->isHidden()) { $actions->addAction( id(new PhabricatorActionView()) - ->setName(pht('Delete column')) - ->setIcon('fa-times') + ->setName(pht('Hide Column')) + ->setIcon('fa-eye-slash') ->setHref($this->getApplicationURI($base_uri.'delete/'.$id.'/')) ->setDisabled(!$can_edit) ->setWorkflow(true)); } else { $actions->addAction( id(new PhabricatorActionView()) - ->setName(pht('Activate column')) - ->setIcon('fa-play-circle-o') + ->setName(pht('Show Column')) + ->setIcon('fa-eye') ->setHref($this->getApplicationURI($base_uri.'delete/'.$id.'/')) ->setDisabled(!$can_edit) ->setWorkflow(true)); diff --git a/src/applications/project/phid/PhabricatorProjectPHIDTypeColumn.php b/src/applications/project/phid/PhabricatorProjectPHIDTypeColumn.php --- a/src/applications/project/phid/PhabricatorProjectPHIDTypeColumn.php +++ b/src/applications/project/phid/PhabricatorProjectPHIDTypeColumn.php @@ -38,8 +38,7 @@ $handle->setName($column->getDisplayName()); $handle->setURI('/project/board/'.$column->getProject()->getID().'/'); - $handle->setDisabled( - $column->getStatus() == PhabricatorProjectColumn::STATUS_DELETED); + $handle->setDisabled($column->isHidden()); } } diff --git a/src/applications/project/storage/PhabricatorProjectColumn.php b/src/applications/project/storage/PhabricatorProjectColumn.php --- a/src/applications/project/storage/PhabricatorProjectColumn.php +++ b/src/applications/project/storage/PhabricatorProjectColumn.php @@ -6,7 +6,7 @@ PhabricatorDestructableInterface { const STATUS_ACTIVE = 0; - const STATUS_DELETED = 1; + const STATUS_HIDDEN = 1; protected $name; protected $status; @@ -45,8 +45,8 @@ return ($this->getSequence() == 0); } - public function isDeleted() { - return ($this->getStatus() == self::STATUS_DELETED); + public function isHidden() { + return ($this->getStatus() == self::STATUS_HIDDEN); } public function getDisplayName() { @@ -57,6 +57,10 @@ } public function getHeaderColor() { + if ($this->isHidden()) { + return PHUIActionHeaderView::HEADER_LIGHTRED; + } + if ($this->isDefaultColumn()) { return PHUIActionHeaderView::HEADER_DARK_GREY; } diff --git a/src/applications/project/storage/PhabricatorProjectColumnTransaction.php b/src/applications/project/storage/PhabricatorProjectColumnTransaction.php --- a/src/applications/project/storage/PhabricatorProjectColumnTransaction.php +++ b/src/applications/project/storage/PhabricatorProjectColumnTransaction.php @@ -36,11 +36,11 @@ switch ($new) { case PhabricatorProjectColumn::STATUS_ACTIVE: return pht( - '%s activated this column.', + '%s marked this column visible.', $author_handle); - case PhabricatorProjectColumn::STATUS_DELETED: + case PhabricatorProjectColumn::STATUS_HIDDEN: return pht( - '%s deleted this column.', + '%s marked this column hidden.', $author_handle); } break;