1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-18 10:41:08 +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:
epriestley 2016-02-04 07:50:58 -08:00
parent 42954bc5ac
commit c01f23adfb
5 changed files with 64 additions and 22 deletions

View file

@ -97,9 +97,20 @@ final class PhabricatorProjectBoardReorderController
->setFlush(true);
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())
->setHeader($column->getDisplayName())
->addIcon('none', $column->getDisplayType());
->addIcon($column->getHeaderIcon(), $column->getDisplayType());
if ($column->isHidden()) {
$item->setDisabled(true);

View file

@ -22,6 +22,8 @@ final class PhabricatorProjectColumnDetailController
}
$this->setProject($project);
$project_id = $project->getID();
$column = id(new PhabricatorProjectColumnQuery())
->setViewer($viewer)
->withIDs(array($id))
@ -45,6 +47,10 @@ final class PhabricatorProjectColumnDetailController
$actions = $this->buildActionView($column);
$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())
->setHeader($header)
->addPropertyList($properties);
@ -54,6 +60,7 @@ final class PhabricatorProjectColumnDetailController
return $this->newPage()
->setTitle($title)
->setNavigation($nav)
->setCrumbs($crumbs)
->appendChild(
array(
$box,

View file

@ -81,10 +81,12 @@ final class PhabricatorProjectColumnEditController
$xactions = array();
if (!$column->getProxy()) {
$type_name = PhabricatorProjectColumnTransaction::TYPE_NAME;
$xactions[] = id(new PhabricatorProjectColumnTransaction())
->setTransactionType($type_name)
->setNewValue($v_name);
}
$type_limit = PhabricatorProjectColumnTransaction::TYPE_LIMIT;
$xactions[] = id(new PhabricatorProjectColumnTransaction())
@ -105,18 +107,19 @@ final class PhabricatorProjectColumnEditController
}
}
$form = new AphrontFormView();
$form
->setUser($request->getUser())
->appendChild(
$form = id(new AphrontFormView())
->setUser($request->getUser());
if (!$column->getProxy()) {
$form->appendChild(
id(new AphrontFormTextControl())
->setValue($v_name)
->setLabel(pht('Name'))
->setName('name')
->setError($e_name)
->setCaption(
pht('This will be displayed as the header of the column.')))
->appendChild(
->setError($e_name));
}
$form->appendChild(
id(new AphrontFormTextControl())
->setValue($v_limit)
->setLabel(pht('Point Limit'))
@ -125,7 +128,6 @@ final class PhabricatorProjectColumnEditController
->setCaption(
pht('Maximum number of points of tasks allowed in the column.')));
if ($is_new) {
$title = pht('Create Column');
$submit = pht('Create Column');

View file

@ -317,7 +317,7 @@ final class PhabricatorBoardLayoutEngine extends Phobject {
->setViewer($viewer)
->withProjectPHIDs(array_keys($boards))
->execute();
$columns = msort($columns, 'getSequence');
$columns = msort($columns, 'getOrderingKey');
$columns = mpull($columns, null, 'getPHID');
$need_children = array();
@ -368,6 +368,8 @@ final class PhabricatorBoardLayoutEngine extends Phobject {
}
}
$board_columns = msort($board_columns, 'getOrderingKey');
$columns[$board_phid] = $board_columns;
}

View file

@ -27,7 +27,8 @@ final class PhabricatorProjectColumn
public static function initializeNewColumn(PhabricatorUser $user) {
return id(new PhabricatorProjectColumn())
->setName('')
->setStatus(self::STATUS_ACTIVE);
->setStatus(self::STATUS_ACTIVE)
->attachProxy(null);
}
protected function getConfiguration() {
@ -157,6 +158,25 @@ final class PhabricatorProjectColumn
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 )------------------------- */