Use PropertyListView in Diffusion's repository view

Summary: Precursor to adding ActionList. Ref T2231.

Test Plan: {F44153}

Reviewers: chad, btrahan

Reviewed By: chad

CC: aran

Maniphest Tasks: T2231

Differential Revision: https://secure.phabricator.com/D6027
This commit is contained in:
epriestley 2013-05-24 10:48:10 -07:00
parent 6f2f9ea103
commit 440c76eca5

View file

@ -136,38 +136,32 @@ final class DiffusionRepositoryController extends DiffusionController {
private function buildPropertiesTable(PhabricatorRepository $repository) { private function buildPropertiesTable(PhabricatorRepository $repository) {
$properties = array(); $header = id(new PhabricatorHeaderView())
$properties['Name'] = $repository->getName(); ->setHeader($repository->getName());
$properties['Callsign'] = $repository->getCallsign();
$properties['Description'] = $repository->getDetail('description'); $view = new PhabricatorPropertyListView();
$view->addProperty(pht('Callsign'), $repository->getCallsign());
switch ($repository->getVersionControlSystem()) { switch ($repository->getVersionControlSystem()) {
case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT: case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT:
case PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL: case PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL:
$properties['Clone URI'] = $repository->getPublicRemoteURI(); $view->addProperty(
pht('Clone URI'),
$repository->getPublicRemoteURI());
break; break;
case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN: case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN:
$properties['Repository Root'] = $repository->getPublicRemoteURI(); $view->addProperty(
pht('Repository Root'),
$repository->getPublicRemoteURI());
break; break;
} }
$rows = array(); $description = $repository->getDetail('description');
foreach ($properties as $key => $value) { if (strlen($description)) {
$rows[] = array($key, $value); $view->addTextContent($description);
} }
$table = new AphrontTableView($rows); return array($header, $view);
$table->setColumnClasses(
array(
'header',
'wide',
));
$panel = new AphrontPanelView();
$panel->setHeader(pht('Repository Properties'));
$panel->appendChild($table);
$panel->setNoBackground();
return $panel;
} }
private function buildBranchListTable(DiffusionRequest $drequest) { private function buildBranchListTable(DiffusionRequest $drequest) {