Changeset View
Changeset View
Standalone View
Standalone View
src/applications/diffusion/controller/DiffusionController.php
Show First 20 Lines • Show All 117 Lines • ▼ Show 20 Lines | foreach ($crumb_list as $crumb) { | ||||
$crumbs->addCrumb($crumb); | $crumbs->addCrumb($crumb); | ||||
} | } | ||||
return $crumbs; | return $crumbs; | ||||
} | } | ||||
private function buildCrumbList(array $spec = array()) { | private function buildCrumbList(array $spec = array()) { | ||||
$spec = $spec + array( | $spec = $spec + array( | ||||
'commit' => null, | 'commit' => null, | ||||
'tags' => null, | 'tags' => null, | ||||
'branches' => null, | 'branches' => null, | ||||
'view' => null, | 'view' => null, | ||||
); | ); | ||||
$crumb_list = array(); | $crumb_list = array(); | ||||
// On the home page, we don't have a DiffusionRequest. | // On the home page, we don't have a DiffusionRequest. | ||||
if ($this->hasDiffusionRequest()) { | if ($this->hasDiffusionRequest()) { | ||||
$drequest = $this->getDiffusionRequest(); | $drequest = $this->getDiffusionRequest(); | ||||
$repository = $drequest->getRepository(); | $repository = $drequest->getRepository(); | ||||
▲ Show 20 Lines • Show All 172 Lines • ▼ Show 20 Lines | if ($path_parts) { | ||||
$links[] = $divider; | $links[] = $divider; | ||||
} | } | ||||
return $links; | return $links; | ||||
} | } | ||||
protected function renderStatusMessage($title, $body) { | protected function renderStatusMessage($title, $body) { | ||||
return id(new PHUIInfoView()) | return id(new PHUIInfoView()) | ||||
->setSeverity(PHUIInfoView::SEVERITY_WARNING) | ->setSeverity(PHUIInfoView::SEVERITY_NOTICE) | ||||
->setTitle($title) | ->setTitle($title) | ||||
->setFlush(true) | ->setFlush(true) | ||||
->appendChild($body); | ->appendChild($body); | ||||
} | } | ||||
protected function renderCommitHashTag(DiffusionRequest $drequest) { | protected function renderCommitHashTag(DiffusionRequest $drequest) { | ||||
$stable_commit = $drequest->getStableCommit(); | $stable_commit = $drequest->getStableCommit(); | ||||
$commit = phutil_tag( | $commit = phutil_tag( | ||||
▲ Show 20 Lines • Show All 78 Lines • ▼ Show 20 Lines | protected function renderDirectoryReadme(DiffusionBrowseResultSet $browse) { | ||||
} | } | ||||
return id(new DiffusionReadmeView()) | return id(new DiffusionReadmeView()) | ||||
->setUser($this->getViewer()) | ->setUser($this->getViewer()) | ||||
->setPath($readme_path) | ->setPath($readme_path) | ||||
->setContent($readme_corpus); | ->setContent($readme_corpus); | ||||
} | } | ||||
protected function buildTabsView($key) { | |||||
$drequest = $this->getDiffusionRequest(); | |||||
$repository = $drequest->getRepository(); | |||||
$view = new PHUIListView(); | |||||
$view->addMenuItem( | |||||
id(new PHUIListItemView()) | |||||
->setKey('home') | |||||
->setName(pht('Home')) | |||||
->setIcon('fa-home') | |||||
->setHref($drequest->generateURI( | |||||
array( | |||||
'action' => 'branch', | |||||
'path' => '/', | |||||
))) | |||||
->setSelected($key == 'home')); | |||||
if (!$repository->isSVN()) { | |||||
epriestley: `$drequest->supportsBranches()` is possibly a better test, but there's no equivalent for tags… | |||||
$view->addMenuItem( | |||||
id(new PHUIListItemView()) | |||||
->setKey('branch') | |||||
->setName(pht('Branches')) | |||||
->setIcon('fa-code-fork') | |||||
->setHref($drequest->generateURI( | |||||
array( | |||||
'action' => 'branches', | |||||
))) | |||||
->setSelected($key == 'branch')); | |||||
} | |||||
if (!$repository->isSVN()) { | |||||
$view->addMenuItem( | |||||
id(new PHUIListItemView()) | |||||
->setKey('tags') | |||||
->setName(pht('Tags')) | |||||
->setIcon('fa-tags') | |||||
->setHref($drequest->generateURI( | |||||
array( | |||||
'action' => 'tags', | |||||
))) | |||||
->setSelected($key == 'tags')); | |||||
} | |||||
$view->addMenuItem( | |||||
id(new PHUIListItemView()) | |||||
->setKey('history') | |||||
->setName(pht('History')) | |||||
->setIcon('fa-history') | |||||
->setHref($drequest->generateURI( | |||||
array( | |||||
'action' => 'history', | |||||
))) | |||||
->setSelected($key == 'history')); | |||||
$view->addMenuItem( | |||||
id(new PHUIListItemView()) | |||||
->setKey('graph') | |||||
->setName(pht('Graph')) | |||||
->setIcon('fa-code-fork') | |||||
->setHref($drequest->generateURI( | |||||
array( | |||||
'action' => 'graph', | |||||
))) | |||||
->setSelected($key == 'graph')); | |||||
return $view; | |||||
} | |||||
} | } |
$drequest->supportsBranches() is possibly a better test, but there's no equivalent for tags and this is flimsy anwyay.