Allow EditEngine create and edit forms to be reordered

Summary:
Ref T9132. Ref T9908. Puts reordering UI in place:

  - For create forms, this just lets you pick a UI display order other than alphabetical. Seems nice to have.
  - For edit forms, this lets you create a hierarchy of advanced-to-basic forms and give them different visibility policies, if you want.

Test Plan:
{F1017842}

  - Verified that "Edit Thing" now takes me to the highest-ranked edit form.
  - Verified that create menu and quick create menu reflect application order.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T9132, T9908

Differential Revision: https://secure.phabricator.com/D14704
This commit is contained in:
epriestley
2015-12-08 06:14:47 -08:00
parent 2f8e409876
commit 59ae0d6fff
11 changed files with 309 additions and 5 deletions

View File

@@ -8,11 +8,44 @@ final class PhabricatorEditEngineConfigurationListController
}
public function handleRequest(AphrontRequest $request) {
$this->setEngineKey($request->getURIData('engineKey'));
$viewer = $this->getViewer();
$engine_key = $request->getURIData('engineKey');
$this->setEngineKey($engine_key);
$engine = PhabricatorEditEngine::getByKey($viewer, $engine_key);
$items = array();
$items[] = id(new PHUIListItemView())
->setType(PHUIListItemView::TYPE_LABEL)
->setName(pht('Form Order'));
$sort_create_uri = "/transactions/editengine/{$engine_key}/sort/create/";
$sort_edit_uri = "/transactions/editengine/{$engine_key}/sort/edit/";
$can_edit = PhabricatorPolicyFilter::hasCapability(
$viewer,
$engine,
PhabricatorPolicyCapability::CAN_EDIT);
$items[] = id(new PHUIListItemView())
->setType(PHUIListItemView::TYPE_LINK)
->setName(pht('Reorder Create Forms'))
->setHref($sort_create_uri)
->setWorkflow(true)
->setDisabled(!$can_edit);
$items[] = id(new PHUIListItemView())
->setType(PHUIListItemView::TYPE_LINK)
->setName(pht('Reorder Edit Forms'))
->setHref($sort_edit_uri)
->setWorkflow(true)
->setDisabled(!$can_edit);
return id(new PhabricatorEditEngineConfigurationSearchEngine())
->setController($this)
->setEngineKey($this->getEngineKey())
->setNavigationItems($items)
->buildResponse();
}