mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-16 03:42:41 +01:00
c0d42a8943
Summary: Ref T10748. This allows an EditEngine form to be broken up into pages. This is less powerful than `PHUIPagedFormView`, because the pages are not sequential / stateful. Each form saves immediately once it's submitted, and can not take you to a new form or back/forward in a series of forms. For example, you can't create a workflow where the user fills out 5 pages of information before we create an object, like the current repository workflow does. However, the only place we've ever wanted to do this is repositories and it's fairly bad there, so I feel reasonably confident we aren't going to miss this in the future. (We do "choose a type of service/repository/rule -> fill out one page of info" fairly often, but can do this without the full-power paging stuff.) Test Plan: - Created a repository usin the new Manage UI, filling out only a handful of fields. - Edited a repository using the new Manage UI. - All forms are now EditEngine forms offering paged views of the big huge underlying form: {F1254371} Reviewers: chad Reviewed By: chad Maniphest Tasks: T10748 Differential Revision: https://secure.phabricator.com/D15832
76 lines
2 KiB
PHP
76 lines
2 KiB
PHP
<?php
|
|
|
|
final class DiffusionRepositoryBranchesManagementPanel
|
|
extends DiffusionRepositoryManagementPanel {
|
|
|
|
const PANELKEY = 'branches';
|
|
|
|
public function getManagementPanelLabel() {
|
|
return pht('Branches');
|
|
}
|
|
|
|
public function getManagementPanelOrder() {
|
|
return 1000;
|
|
}
|
|
|
|
protected function getEditEngineFieldKeys() {
|
|
return array(
|
|
'defaultBranch',
|
|
'trackOnly',
|
|
'autocloseOnly',
|
|
);
|
|
}
|
|
|
|
protected function buildManagementPanelActions() {
|
|
$repository = $this->getRepository();
|
|
$viewer = $this->getViewer();
|
|
|
|
$can_edit = PhabricatorPolicyFilter::hasCapability(
|
|
$viewer,
|
|
$repository,
|
|
PhabricatorPolicyCapability::CAN_EDIT);
|
|
|
|
$branches_uri = $this->getEditPageURI();
|
|
|
|
return array(
|
|
id(new PhabricatorActionView())
|
|
->setIcon('fa-pencil')
|
|
->setName(pht('Edit Branches'))
|
|
->setHref($branches_uri)
|
|
->setDisabled(!$can_edit)
|
|
->setWorkflow(!$can_edit),
|
|
);
|
|
}
|
|
|
|
public function buildManagementPanelContent() {
|
|
$repository = $this->getRepository();
|
|
$viewer = $this->getViewer();
|
|
|
|
$view = id(new PHUIPropertyListView())
|
|
->setViewer($viewer)
|
|
->setActionList($this->newActions());
|
|
|
|
$default_branch = nonempty(
|
|
$repository->getHumanReadableDetail('default-branch'),
|
|
phutil_tag('em', array(), $repository->getDefaultBranch()));
|
|
$view->addProperty(pht('Default Branch'), $default_branch);
|
|
|
|
$track_only = nonempty(
|
|
$repository->getHumanReadableDetail('branch-filter', array()),
|
|
phutil_tag('em', array(), pht('Track All Branches')));
|
|
$view->addProperty(pht('Track Only'), $track_only);
|
|
|
|
$autoclose_only = nonempty(
|
|
$repository->getHumanReadableDetail('close-commits-filter', array()),
|
|
phutil_tag('em', array(), pht('Autoclose On All Branches')));
|
|
|
|
if ($repository->getDetail('disable-autoclose')) {
|
|
$autoclose_only = phutil_tag('em', array(), pht('Disabled'));
|
|
}
|
|
|
|
$view->addProperty(pht('Autoclose Only'), $autoclose_only);
|
|
|
|
return $this->newBox(pht('Branches'), $view);
|
|
}
|
|
|
|
}
|