mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-23 07:12:41 +01:00
Allow the Default/Backlog column to be renamed
Summary: Fixes T5101. There's no technical reason not to allow this, it just took a little extra work so I didn't do it originally. Test Plan: Renamed "Backlog", un-renamed it. Tried to hide it. Reviewers: chad Reviewed By: chad Subscribers: epriestley Maniphest Tasks: T5101 Differential Revision: https://secure.phabricator.com/D9721
This commit is contained in:
parent
a823d143b4
commit
f1c638d231
7 changed files with 54 additions and 18 deletions
|
@ -42,10 +42,17 @@ final class PhabricatorProjectBoardDeleteController
|
|||
}
|
||||
|
||||
$column_phid = $column->getPHID();
|
||||
|
||||
$view_uri = $this->getApplicationURI(
|
||||
'/board/'.$this->projectID.'/column/'.$this->id.'/');
|
||||
|
||||
if ($column->isDefaultColumn()) {
|
||||
return $this->newDialog()
|
||||
->setTitle(pht('Can Not Hide Default Column'))
|
||||
->appendParagraph(
|
||||
pht('You can not hide the default/backlog column on a board.'))
|
||||
->addCancelButton($view_uri, pht('Okay'));
|
||||
}
|
||||
|
||||
if ($request->isFormPost()) {
|
||||
if ($column->isHidden()) {
|
||||
$new_status = PhabricatorProjectColumn::STATUS_ACTIVE;
|
||||
|
|
|
@ -111,9 +111,11 @@ final class PhabricatorProjectBoardEditController
|
|||
if ($is_new) {
|
||||
$title = pht('Create Column');
|
||||
$submit = pht('Create Column');
|
||||
$crumb_text = pht('Create Column');
|
||||
} else {
|
||||
$title = pht('Edit %s', $column->getName());
|
||||
$title = pht('Edit %s', $column->getDisplayName());
|
||||
$submit = pht('Save Column');
|
||||
$crumb_text = pht('Edit');
|
||||
}
|
||||
|
||||
$form->appendChild(
|
||||
|
@ -125,7 +127,14 @@ final class PhabricatorProjectBoardEditController
|
|||
$crumbs->addTextCrumb(
|
||||
pht('Board'),
|
||||
$this->getApplicationURI('board/'.$project->getID().'/'));
|
||||
$crumbs->addTextCrumb($title);
|
||||
|
||||
if (!$is_new) {
|
||||
$crumbs->addTextCrumb(
|
||||
$column->getDisplayName(),
|
||||
$view_uri);
|
||||
}
|
||||
|
||||
$crumbs->addTextCrumb($crumb_text);
|
||||
|
||||
$form_box = id(new PHUIObjectBoxView())
|
||||
->setHeaderText($title)
|
||||
|
|
|
@ -175,9 +175,7 @@ final class PhabricatorProjectBoardViewController
|
|||
->setHeader($column->getDisplayName())
|
||||
->setHeaderColor($column->getHeaderColor());
|
||||
|
||||
if (!$column->isDefaultColumn()) {
|
||||
$panel->setEditURI($board_uri.'column/'.$column->getID().'/');
|
||||
}
|
||||
|
||||
$panel->setHeaderAction(id(new PHUIIconView())
|
||||
->setIconFont('fa-plus')
|
||||
|
|
|
@ -54,7 +54,7 @@ final class PhabricatorProjectColumnDetailController
|
|||
->setObjectPHID($column->getPHID())
|
||||
->setTransactions($xactions);
|
||||
|
||||
$title = pht('%s', $column->getName());
|
||||
$title = pht('%s', $column->getDisplayName());
|
||||
$crumbs = $this->buildApplicationCrumbs();
|
||||
$crumbs->addTextCrumb(
|
||||
pht('Board'),
|
||||
|
@ -85,7 +85,7 @@ final class PhabricatorProjectColumnDetailController
|
|||
|
||||
$header = id(new PHUIHeaderView())
|
||||
->setUser($viewer)
|
||||
->setHeader($column->getName())
|
||||
->setHeader($column->getDisplayName())
|
||||
->setPolicyObject($column);
|
||||
|
||||
if ($column->isHidden()) {
|
||||
|
@ -119,13 +119,15 @@ 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_edit)
|
||||
->setDisabled(!$can_hide)
|
||||
->setWorkflow(true));
|
||||
} else {
|
||||
$actions->addAction(
|
||||
|
@ -133,7 +135,7 @@ final class PhabricatorProjectColumnDetailController
|
|||
->setName(pht('Show Column'))
|
||||
->setIcon('fa-eye')
|
||||
->setHref($this->getApplicationURI($base_uri.'delete/'.$id.'/'))
|
||||
->setDisabled(!$can_edit)
|
||||
->setDisabled(!$can_hide)
|
||||
->setWorkflow(true));
|
||||
}
|
||||
|
||||
|
|
|
@ -81,7 +81,10 @@ final class PhabricatorProjectColumnTransactionEditor
|
|||
$object->getName(),
|
||||
$xactions);
|
||||
|
||||
if ($missing) {
|
||||
// The default "Backlog" column is allowed to be unnamed, which
|
||||
// means we use the default name.
|
||||
|
||||
if ($missing && !$object->isDefaultColumn()) {
|
||||
$error = new PhabricatorApplicationTransactionValidationError(
|
||||
$type,
|
||||
pht('Required'),
|
||||
|
|
|
@ -50,10 +50,16 @@ final class PhabricatorProjectColumn
|
|||
}
|
||||
|
||||
public function getDisplayName() {
|
||||
$name = $this->getName();
|
||||
if (strlen($name)) {
|
||||
return $name;
|
||||
}
|
||||
|
||||
if ($this->isDefaultColumn()) {
|
||||
return pht('Backlog');
|
||||
}
|
||||
return $this->getName();
|
||||
|
||||
return pht('Unnamed Column');
|
||||
}
|
||||
|
||||
public function getHeaderColor() {
|
||||
|
|
|
@ -21,16 +21,27 @@ final class PhabricatorProjectColumnTransaction
|
|||
|
||||
switch ($this->getTransactionType()) {
|
||||
case PhabricatorProjectColumnTransaction::TYPE_NAME:
|
||||
if (!strlen($old)) {
|
||||
if ($old === null) {
|
||||
return pht(
|
||||
'%s created this column.',
|
||||
$author_handle);
|
||||
} else {
|
||||
if (!strlen($old)) {
|
||||
return pht(
|
||||
'%s named this column "%s".',
|
||||
$author_handle,
|
||||
$new);
|
||||
} else if (strlen($new)) {
|
||||
return pht(
|
||||
'%s renamed this column from "%s" to "%s".',
|
||||
$author_handle,
|
||||
$old,
|
||||
$new);
|
||||
} else {
|
||||
return pht(
|
||||
'%s removed the custom name of this column.',
|
||||
$author_handle);
|
||||
}
|
||||
}
|
||||
case PhabricatorProjectColumnTransaction::TYPE_STATUS:
|
||||
switch ($new) {
|
||||
|
|
Loading…
Reference in a new issue