mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-18 18:51:12 +01:00
Improve some column behaviors for Milestone/Subproject columns
Summary: Ref T10010. - Don't allow milestones to be reordered. - Hide phantom subproject columns when reodrering. - Don't allow subproject/milestone columns to be renamed. - Force milestones to be ordered at the end, and in the correct order. - Add some missing crumbs. Test Plan: Reordered columns, renamed columns, made a new column, viewed column details. Reviewers: chad Reviewed By: chad Maniphest Tasks: T10010 Differential Revision: https://secure.phabricator.com/D15183
This commit is contained in:
parent
42954bc5ac
commit
c01f23adfb
5 changed files with 64 additions and 22 deletions
|
@ -97,9 +97,20 @@ final class PhabricatorProjectBoardReorderController
|
||||||
->setFlush(true);
|
->setFlush(true);
|
||||||
|
|
||||||
foreach ($columns as $column) {
|
foreach ($columns as $column) {
|
||||||
|
// Don't allow milestone columns to be reordered.
|
||||||
|
$proxy = $column->getProxy();
|
||||||
|
if ($proxy && $proxy->isMilestone()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// At least for now, don't show subproject column.
|
||||||
|
if ($proxy) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$item = id(new PHUIObjectItemView())
|
$item = id(new PHUIObjectItemView())
|
||||||
->setHeader($column->getDisplayName())
|
->setHeader($column->getDisplayName())
|
||||||
->addIcon('none', $column->getDisplayType());
|
->addIcon($column->getHeaderIcon(), $column->getDisplayType());
|
||||||
|
|
||||||
if ($column->isHidden()) {
|
if ($column->isHidden()) {
|
||||||
$item->setDisabled(true);
|
$item->setDisabled(true);
|
||||||
|
|
|
@ -22,6 +22,8 @@ final class PhabricatorProjectColumnDetailController
|
||||||
}
|
}
|
||||||
$this->setProject($project);
|
$this->setProject($project);
|
||||||
|
|
||||||
|
$project_id = $project->getID();
|
||||||
|
|
||||||
$column = id(new PhabricatorProjectColumnQuery())
|
$column = id(new PhabricatorProjectColumnQuery())
|
||||||
->setViewer($viewer)
|
->setViewer($viewer)
|
||||||
->withIDs(array($id))
|
->withIDs(array($id))
|
||||||
|
@ -45,6 +47,10 @@ final class PhabricatorProjectColumnDetailController
|
||||||
$actions = $this->buildActionView($column);
|
$actions = $this->buildActionView($column);
|
||||||
$properties = $this->buildPropertyView($column, $actions);
|
$properties = $this->buildPropertyView($column, $actions);
|
||||||
|
|
||||||
|
$crumbs = $this->buildApplicationCrumbs();
|
||||||
|
$crumbs->addTextCrumb(pht('Workboard'), "/project/board/{$project_id}/");
|
||||||
|
$crumbs->addTextCrumb(pht('Column: %s', $title));
|
||||||
|
|
||||||
$box = id(new PHUIObjectBoxView())
|
$box = id(new PHUIObjectBoxView())
|
||||||
->setHeader($header)
|
->setHeader($header)
|
||||||
->addPropertyList($properties);
|
->addPropertyList($properties);
|
||||||
|
@ -54,6 +60,7 @@ final class PhabricatorProjectColumnDetailController
|
||||||
return $this->newPage()
|
return $this->newPage()
|
||||||
->setTitle($title)
|
->setTitle($title)
|
||||||
->setNavigation($nav)
|
->setNavigation($nav)
|
||||||
|
->setCrumbs($crumbs)
|
||||||
->appendChild(
|
->appendChild(
|
||||||
array(
|
array(
|
||||||
$box,
|
$box,
|
||||||
|
|
|
@ -81,10 +81,12 @@ final class PhabricatorProjectColumnEditController
|
||||||
|
|
||||||
$xactions = array();
|
$xactions = array();
|
||||||
|
|
||||||
|
if (!$column->getProxy()) {
|
||||||
$type_name = PhabricatorProjectColumnTransaction::TYPE_NAME;
|
$type_name = PhabricatorProjectColumnTransaction::TYPE_NAME;
|
||||||
$xactions[] = id(new PhabricatorProjectColumnTransaction())
|
$xactions[] = id(new PhabricatorProjectColumnTransaction())
|
||||||
->setTransactionType($type_name)
|
->setTransactionType($type_name)
|
||||||
->setNewValue($v_name);
|
->setNewValue($v_name);
|
||||||
|
}
|
||||||
|
|
||||||
$type_limit = PhabricatorProjectColumnTransaction::TYPE_LIMIT;
|
$type_limit = PhabricatorProjectColumnTransaction::TYPE_LIMIT;
|
||||||
$xactions[] = id(new PhabricatorProjectColumnTransaction())
|
$xactions[] = id(new PhabricatorProjectColumnTransaction())
|
||||||
|
@ -105,18 +107,19 @@ final class PhabricatorProjectColumnEditController
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$form = new AphrontFormView();
|
$form = id(new AphrontFormView())
|
||||||
$form
|
->setUser($request->getUser());
|
||||||
->setUser($request->getUser())
|
|
||||||
->appendChild(
|
if (!$column->getProxy()) {
|
||||||
|
$form->appendChild(
|
||||||
id(new AphrontFormTextControl())
|
id(new AphrontFormTextControl())
|
||||||
->setValue($v_name)
|
->setValue($v_name)
|
||||||
->setLabel(pht('Name'))
|
->setLabel(pht('Name'))
|
||||||
->setName('name')
|
->setName('name')
|
||||||
->setError($e_name)
|
->setError($e_name));
|
||||||
->setCaption(
|
}
|
||||||
pht('This will be displayed as the header of the column.')))
|
|
||||||
->appendChild(
|
$form->appendChild(
|
||||||
id(new AphrontFormTextControl())
|
id(new AphrontFormTextControl())
|
||||||
->setValue($v_limit)
|
->setValue($v_limit)
|
||||||
->setLabel(pht('Point Limit'))
|
->setLabel(pht('Point Limit'))
|
||||||
|
@ -125,7 +128,6 @@ final class PhabricatorProjectColumnEditController
|
||||||
->setCaption(
|
->setCaption(
|
||||||
pht('Maximum number of points of tasks allowed in the column.')));
|
pht('Maximum number of points of tasks allowed in the column.')));
|
||||||
|
|
||||||
|
|
||||||
if ($is_new) {
|
if ($is_new) {
|
||||||
$title = pht('Create Column');
|
$title = pht('Create Column');
|
||||||
$submit = pht('Create Column');
|
$submit = pht('Create Column');
|
||||||
|
|
|
@ -317,7 +317,7 @@ final class PhabricatorBoardLayoutEngine extends Phobject {
|
||||||
->setViewer($viewer)
|
->setViewer($viewer)
|
||||||
->withProjectPHIDs(array_keys($boards))
|
->withProjectPHIDs(array_keys($boards))
|
||||||
->execute();
|
->execute();
|
||||||
$columns = msort($columns, 'getSequence');
|
$columns = msort($columns, 'getOrderingKey');
|
||||||
$columns = mpull($columns, null, 'getPHID');
|
$columns = mpull($columns, null, 'getPHID');
|
||||||
|
|
||||||
$need_children = array();
|
$need_children = array();
|
||||||
|
@ -368,6 +368,8 @@ final class PhabricatorBoardLayoutEngine extends Phobject {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$board_columns = msort($board_columns, 'getOrderingKey');
|
||||||
|
|
||||||
$columns[$board_phid] = $board_columns;
|
$columns[$board_phid] = $board_columns;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,8 @@ final class PhabricatorProjectColumn
|
||||||
public static function initializeNewColumn(PhabricatorUser $user) {
|
public static function initializeNewColumn(PhabricatorUser $user) {
|
||||||
return id(new PhabricatorProjectColumn())
|
return id(new PhabricatorProjectColumn())
|
||||||
->setName('')
|
->setName('')
|
||||||
->setStatus(self::STATUS_ACTIVE);
|
->setStatus(self::STATUS_ACTIVE)
|
||||||
|
->attachProxy(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getConfiguration() {
|
protected function getConfiguration() {
|
||||||
|
@ -157,6 +158,25 @@ final class PhabricatorProjectColumn
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getOrderingKey() {
|
||||||
|
$proxy = $this->getProxy();
|
||||||
|
|
||||||
|
// Normal columns and subproject columns go first, in a user-controlled
|
||||||
|
// order.
|
||||||
|
|
||||||
|
// All the milestone columns go last, in their sequential order.
|
||||||
|
|
||||||
|
if (!$proxy || !$proxy->isMilestone()) {
|
||||||
|
$group = 'A';
|
||||||
|
$sequence = $this->getSequence();
|
||||||
|
} else {
|
||||||
|
$group = 'B';
|
||||||
|
$sequence = $proxy->getMilestoneNumber();
|
||||||
|
}
|
||||||
|
|
||||||
|
return sprintf('%s%012d', $group, $sequence);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* -( PhabricatorApplicationTransactionInterface )------------------------- */
|
/* -( PhabricatorApplicationTransactionInterface )------------------------- */
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue