Differential D19826 Diff 47381 src/applications/diffusion/management/DiffusionRepositoryBranchesManagementPanel.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/diffusion/management/DiffusionRepositoryBranchesManagementPanel.php
Show All 13 Lines | final class DiffusionRepositoryBranchesManagementPanel | ||||
} | } | ||||
public function shouldEnableForRepository( | public function shouldEnableForRepository( | ||||
PhabricatorRepository $repository) { | PhabricatorRepository $repository) { | ||||
return ($repository->isGit() || $repository->isHg()); | return ($repository->isGit() || $repository->isHg()); | ||||
} | } | ||||
public function getManagementPanelIcon() { | public function getManagementPanelIcon() { | ||||
$repository = $this->getRepository(); | |||||
$has_any = | |||||
$repository->getDetail('default-branch') || | |||||
$repository->getDetail('branch-filter') || | |||||
$repository->getDetail('close-commits-filter'); | |||||
if ($has_any) { | |||||
return 'fa-code-fork'; | return 'fa-code-fork'; | ||||
} else { | |||||
return 'fa-code-fork grey'; | |||||
} | |||||
} | } | ||||
protected function getEditEngineFieldKeys() { | protected function getEditEngineFieldKeys() { | ||||
return array( | return array( | ||||
'defaultBranch', | 'defaultBranch', | ||||
'trackOnly', | 'trackOnly', | ||||
'autocloseOnly', | 'autocloseOnly', | ||||
); | ); | ||||
} | } | ||||
public function buildManagementPanelCurtain() { | |||||
$repository = $this->getRepository(); | |||||
$viewer = $this->getViewer(); | |||||
$action_list = $this->newActionList(); | |||||
$can_edit = PhabricatorPolicyFilter::hasCapability( | |||||
$viewer, | |||||
$repository, | |||||
PhabricatorPolicyCapability::CAN_EDIT); | |||||
$branches_uri = $this->getEditPageURI(); | |||||
$action_list->addAction( | |||||
id(new PhabricatorActionView()) | |||||
->setIcon('fa-pencil') | |||||
->setName(pht('Edit Branches')) | |||||
->setHref($branches_uri) | |||||
->setDisabled(!$can_edit) | |||||
->setWorkflow(!$can_edit)); | |||||
return $this->newCurtainView() | |||||
->setActionList($action_list); | |||||
} | |||||
public function buildManagementPanelContent() { | public function buildManagementPanelContent() { | ||||
$repository = $this->getRepository(); | $repository = $this->getRepository(); | ||||
$viewer = $this->getViewer(); | $viewer = $this->getViewer(); | ||||
$content = array(); | $content = array(); | ||||
$view = id(new PHUIPropertyListView()) | $view = id(new PHUIPropertyListView()) | ||||
->setViewer($viewer); | ->setViewer($viewer); | ||||
Show All 15 Lines | public function buildManagementPanelContent() { | ||||
if ($repository->getDetail('disable-autoclose')) { | if ($repository->getDetail('disable-autoclose')) { | ||||
$autoclose_disabled = true; | $autoclose_disabled = true; | ||||
$autoclose_only = | $autoclose_only = | ||||
phutil_tag('em', array(), pht('Autoclose has been disabled')); | phutil_tag('em', array(), pht('Autoclose has been disabled')); | ||||
} | } | ||||
$view->addProperty(pht('Autoclose Only'), $autoclose_only); | $view->addProperty(pht('Autoclose Only'), $autoclose_only); | ||||
$can_edit = PhabricatorPolicyFilter::hasCapability( | $content[] = $this->newBox(pht('Branches'), $view); | ||||
$viewer, | |||||
$repository, | |||||
PhabricatorPolicyCapability::CAN_EDIT); | |||||
$branches_uri = $this->getEditPageURI(); | |||||
$button = id(new PHUIButtonView()) | |||||
->setTag('a') | |||||
->setIcon('fa-pencil') | |||||
->setText(pht('Edit')) | |||||
->setHref($branches_uri) | |||||
->setDisabled(!$can_edit) | |||||
->setWorkflow(!$can_edit); | |||||
$content[] = $this->newBox(pht('Branches'), $view, array($button)); | |||||
// Branch Autoclose Table | // Branch Autoclose Table | ||||
if (!$repository->isImporting()) { | if (!$repository->isImporting()) { | ||||
$request = $this->getRequest(); | $request = $this->getRequest(); | ||||
$pager = id(new PHUIPagerView()) | $pager = id(new PHUIPagerView()) | ||||
->readFromRequest($request); | ->readFromRequest($request); | ||||
$params = array( | $params = array( | ||||
▲ Show 20 Lines • Show All 87 Lines • Show Last 20 Lines |