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();
|
$column_phid = $column->getPHID();
|
||||||
|
|
||||||
$view_uri = $this->getApplicationURI(
|
$view_uri = $this->getApplicationURI(
|
||||||
'/board/'.$this->projectID.'/column/'.$this->id.'/');
|
'/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 ($request->isFormPost()) {
|
||||||
if ($column->isHidden()) {
|
if ($column->isHidden()) {
|
||||||
$new_status = PhabricatorProjectColumn::STATUS_ACTIVE;
|
$new_status = PhabricatorProjectColumn::STATUS_ACTIVE;
|
||||||
|
|
|
@ -111,9 +111,11 @@ final class PhabricatorProjectBoardEditController
|
||||||
if ($is_new) {
|
if ($is_new) {
|
||||||
$title = pht('Create Column');
|
$title = pht('Create Column');
|
||||||
$submit = pht('Create Column');
|
$submit = pht('Create Column');
|
||||||
|
$crumb_text = pht('Create Column');
|
||||||
} else {
|
} else {
|
||||||
$title = pht('Edit %s', $column->getName());
|
$title = pht('Edit %s', $column->getDisplayName());
|
||||||
$submit = pht('Save Column');
|
$submit = pht('Save Column');
|
||||||
|
$crumb_text = pht('Edit');
|
||||||
}
|
}
|
||||||
|
|
||||||
$form->appendChild(
|
$form->appendChild(
|
||||||
|
@ -125,7 +127,14 @@ final class PhabricatorProjectBoardEditController
|
||||||
$crumbs->addTextCrumb(
|
$crumbs->addTextCrumb(
|
||||||
pht('Board'),
|
pht('Board'),
|
||||||
$this->getApplicationURI('board/'.$project->getID().'/'));
|
$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())
|
$form_box = id(new PHUIObjectBoxView())
|
||||||
->setHeaderText($title)
|
->setHeaderText($title)
|
||||||
|
|
|
@ -175,9 +175,7 @@ final class PhabricatorProjectBoardViewController
|
||||||
->setHeader($column->getDisplayName())
|
->setHeader($column->getDisplayName())
|
||||||
->setHeaderColor($column->getHeaderColor());
|
->setHeaderColor($column->getHeaderColor());
|
||||||
|
|
||||||
if (!$column->isDefaultColumn()) {
|
|
||||||
$panel->setEditURI($board_uri.'column/'.$column->getID().'/');
|
$panel->setEditURI($board_uri.'column/'.$column->getID().'/');
|
||||||
}
|
|
||||||
|
|
||||||
$panel->setHeaderAction(id(new PHUIIconView())
|
$panel->setHeaderAction(id(new PHUIIconView())
|
||||||
->setIconFont('fa-plus')
|
->setIconFont('fa-plus')
|
||||||
|
|
|
@ -54,7 +54,7 @@ final class PhabricatorProjectColumnDetailController
|
||||||
->setObjectPHID($column->getPHID())
|
->setObjectPHID($column->getPHID())
|
||||||
->setTransactions($xactions);
|
->setTransactions($xactions);
|
||||||
|
|
||||||
$title = pht('%s', $column->getName());
|
$title = pht('%s', $column->getDisplayName());
|
||||||
$crumbs = $this->buildApplicationCrumbs();
|
$crumbs = $this->buildApplicationCrumbs();
|
||||||
$crumbs->addTextCrumb(
|
$crumbs->addTextCrumb(
|
||||||
pht('Board'),
|
pht('Board'),
|
||||||
|
@ -85,7 +85,7 @@ final class PhabricatorProjectColumnDetailController
|
||||||
|
|
||||||
$header = id(new PHUIHeaderView())
|
$header = id(new PHUIHeaderView())
|
||||||
->setUser($viewer)
|
->setUser($viewer)
|
||||||
->setHeader($column->getName())
|
->setHeader($column->getDisplayName())
|
||||||
->setPolicyObject($column);
|
->setPolicyObject($column);
|
||||||
|
|
||||||
if ($column->isHidden()) {
|
if ($column->isHidden()) {
|
||||||
|
@ -119,13 +119,15 @@ final class PhabricatorProjectColumnDetailController
|
||||||
->setDisabled(!$can_edit)
|
->setDisabled(!$can_edit)
|
||||||
->setWorkflow(!$can_edit));
|
->setWorkflow(!$can_edit));
|
||||||
|
|
||||||
|
$can_hide = ($can_edit && !$column->isDefaultColumn());
|
||||||
|
|
||||||
if (!$column->isHidden()) {
|
if (!$column->isHidden()) {
|
||||||
$actions->addAction(
|
$actions->addAction(
|
||||||
id(new PhabricatorActionView())
|
id(new PhabricatorActionView())
|
||||||
->setName(pht('Hide Column'))
|
->setName(pht('Hide Column'))
|
||||||
->setIcon('fa-eye-slash')
|
->setIcon('fa-eye-slash')
|
||||||
->setHref($this->getApplicationURI($base_uri.'delete/'.$id.'/'))
|
->setHref($this->getApplicationURI($base_uri.'delete/'.$id.'/'))
|
||||||
->setDisabled(!$can_edit)
|
->setDisabled(!$can_hide)
|
||||||
->setWorkflow(true));
|
->setWorkflow(true));
|
||||||
} else {
|
} else {
|
||||||
$actions->addAction(
|
$actions->addAction(
|
||||||
|
@ -133,7 +135,7 @@ final class PhabricatorProjectColumnDetailController
|
||||||
->setName(pht('Show Column'))
|
->setName(pht('Show Column'))
|
||||||
->setIcon('fa-eye')
|
->setIcon('fa-eye')
|
||||||
->setHref($this->getApplicationURI($base_uri.'delete/'.$id.'/'))
|
->setHref($this->getApplicationURI($base_uri.'delete/'.$id.'/'))
|
||||||
->setDisabled(!$can_edit)
|
->setDisabled(!$can_hide)
|
||||||
->setWorkflow(true));
|
->setWorkflow(true));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -81,7 +81,10 @@ final class PhabricatorProjectColumnTransactionEditor
|
||||||
$object->getName(),
|
$object->getName(),
|
||||||
$xactions);
|
$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(
|
$error = new PhabricatorApplicationTransactionValidationError(
|
||||||
$type,
|
$type,
|
||||||
pht('Required'),
|
pht('Required'),
|
||||||
|
|
|
@ -50,10 +50,16 @@ final class PhabricatorProjectColumn
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDisplayName() {
|
public function getDisplayName() {
|
||||||
|
$name = $this->getName();
|
||||||
|
if (strlen($name)) {
|
||||||
|
return $name;
|
||||||
|
}
|
||||||
|
|
||||||
if ($this->isDefaultColumn()) {
|
if ($this->isDefaultColumn()) {
|
||||||
return pht('Backlog');
|
return pht('Backlog');
|
||||||
}
|
}
|
||||||
return $this->getName();
|
|
||||||
|
return pht('Unnamed Column');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHeaderColor() {
|
public function getHeaderColor() {
|
||||||
|
|
|
@ -21,16 +21,27 @@ final class PhabricatorProjectColumnTransaction
|
||||||
|
|
||||||
switch ($this->getTransactionType()) {
|
switch ($this->getTransactionType()) {
|
||||||
case PhabricatorProjectColumnTransaction::TYPE_NAME:
|
case PhabricatorProjectColumnTransaction::TYPE_NAME:
|
||||||
if (!strlen($old)) {
|
if ($old === null) {
|
||||||
return pht(
|
return pht(
|
||||||
'%s created this column.',
|
'%s created this column.',
|
||||||
$author_handle);
|
$author_handle);
|
||||||
} else {
|
} else {
|
||||||
|
if (!strlen($old)) {
|
||||||
|
return pht(
|
||||||
|
'%s named this column "%s".',
|
||||||
|
$author_handle,
|
||||||
|
$new);
|
||||||
|
} else if (strlen($new)) {
|
||||||
return pht(
|
return pht(
|
||||||
'%s renamed this column from "%s" to "%s".',
|
'%s renamed this column from "%s" to "%s".',
|
||||||
$author_handle,
|
$author_handle,
|
||||||
$old,
|
$old,
|
||||||
$new);
|
$new);
|
||||||
|
} else {
|
||||||
|
return pht(
|
||||||
|
'%s removed the custom name of this column.',
|
||||||
|
$author_handle);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
case PhabricatorProjectColumnTransaction::TYPE_STATUS:
|
case PhabricatorProjectColumnTransaction::TYPE_STATUS:
|
||||||
switch ($new) {
|
switch ($new) {
|
||||||
|
|
Loading…
Reference in a new issue