Differential D19826 Diff 47381 src/applications/diffusion/management/DiffusionRepositoryURIsManagementPanel.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/diffusion/management/DiffusionRepositoryURIsManagementPanel.php
Show All 11 Lines | final class DiffusionRepositoryURIsManagementPanel | ||||
public function getManagementPanelIcon() { | public function getManagementPanelIcon() { | ||||
return 'fa-globe'; | return 'fa-globe'; | ||||
} | } | ||||
public function getManagementPanelOrder() { | public function getManagementPanelOrder() { | ||||
return 400; | return 400; | ||||
} | } | ||||
public function buildManagementPanelCurtain() { | |||||
$repository = $this->getRepository(); | |||||
$viewer = $this->getViewer(); | |||||
$action_list = $this->newActionList(); | |||||
$can_edit = PhabricatorPolicyFilter::hasCapability( | |||||
$viewer, | |||||
$repository, | |||||
PhabricatorPolicyCapability::CAN_EDIT); | |||||
$doc_href = PhabricatorEnv::getDoclink('Diffusion User Guide: URIs'); | |||||
$add_href = $repository->getPathURI('uri/edit/'); | |||||
$action_list->addAction( | |||||
id(new PhabricatorActionView()) | |||||
->setIcon('fa-plus') | |||||
->setHref($add_href) | |||||
->setDisabled(!$can_edit) | |||||
->setName(pht('Add New URI'))); | |||||
$action_list->addAction( | |||||
id(new PhabricatorActionView()) | |||||
->setIcon('fa-book') | |||||
->setHref($doc_href) | |||||
->setName(pht('URI Documentation'))); | |||||
return $this->newCurtainView() | |||||
->setActionList($action_list); | |||||
} | |||||
public function buildManagementPanelContent() { | public function buildManagementPanelContent() { | ||||
$repository = $this->getRepository(); | $repository = $this->getRepository(); | ||||
$viewer = $this->getViewer(); | $viewer = $this->getViewer(); | ||||
$uris = $repository->getURIs(); | $uris = $repository->getURIs(); | ||||
Javelin::initBehavior('phabricator-tooltips'); | Javelin::initBehavior('phabricator-tooltips'); | ||||
$rows = array(); | $rows = array(); | ||||
foreach ($uris as $uri) { | foreach ($uris as $uri) { | ||||
▲ Show 20 Lines • Show All 89 Lines • ▼ Show 20 Lines | if ($repository->isHosted()) { | ||||
$messages[] = $observe_message; | $messages[] = $observe_message; | ||||
} | } | ||||
$info_view = id(new PHUIInfoView()) | $info_view = id(new PHUIInfoView()) | ||||
->setSeverity(PHUIInfoView::SEVERITY_NOTICE) | ->setSeverity(PHUIInfoView::SEVERITY_NOTICE) | ||||
->setErrors($messages); | ->setErrors($messages); | ||||
$can_edit = PhabricatorPolicyFilter::hasCapability( | $box = $this->newBox(pht('Repository URIs'), $table); | ||||
$viewer, | |||||
$repository, | |||||
PhabricatorPolicyCapability::CAN_EDIT); | |||||
$doc_href = PhabricatorEnv::getDoclink('Diffusion User Guide: URIs'); | |||||
$add_href = $repository->getPathURI('uri/edit/'); | |||||
$add = id(new PHUIButtonView()) | |||||
->setTag('a') | |||||
->setIcon('fa-plus') | |||||
->setHref($add_href) | |||||
->setDisabled(!$can_edit) | |||||
->setText(pht('New URI')); | |||||
$help = id(new PHUIButtonView()) | |||||
->setTag('a') | |||||
->setIcon('fa-book') | |||||
->setHref($doc_href) | |||||
->setText(pht('Help')); | |||||
$box = $this->newBox(pht('Repository URIs'), $table, array($add, $help)); | |||||
return array($box, $info_view); | return array($info_view, $box); | ||||
} | } | ||||
} | } |