mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-28 17:52:43 +01:00
a5dc9067af
Summary: We currently have a lot of calls to `addCrumb(id(new PhabricatorCrumbView())->...)` which can be expressed much more simply with a convenience method. Nearly all crumbs are only textual. Test Plan: - This was mostly automated, then I cleaned up a few unusual sites manually. - Bunch of grep / randomly clicking around. Reviewers: btrahan, chad Reviewed By: btrahan CC: hach-que, aran Differential Revision: https://secure.phabricator.com/D7787
69 lines
1.6 KiB
PHP
69 lines
1.6 KiB
PHP
<?php
|
|
|
|
abstract class PhabricatorOwnersController extends PhabricatorController {
|
|
|
|
private $filter;
|
|
|
|
private function getSideNavFilter() {
|
|
return $this->filter;
|
|
}
|
|
protected function setSideNavFilter($filter) {
|
|
$this->filter = $filter;
|
|
return $this;
|
|
}
|
|
|
|
public function buildSideNavView() {
|
|
$nav = new AphrontSideNavFilterView();
|
|
$base_uri = new PhutilURI('/owners/');
|
|
$nav->setBaseURI($base_uri);
|
|
|
|
$nav->addLabel(pht('Packages'));
|
|
$this->getExtraPackageViews($nav);
|
|
$nav->addFilter('view/owned', pht('Owned'));
|
|
$nav->addFilter('view/projects', pht('Projects'));
|
|
$nav->addFilter('view/all', pht('All'));
|
|
|
|
$nav->selectFilter($this->getSideNavFilter(), 'view/owned');
|
|
|
|
$filter = $nav->getSelectedFilter();
|
|
switch ($filter) {
|
|
case 'view/owned':
|
|
$title = pht('Owned Packages');
|
|
break;
|
|
case 'view/all':
|
|
$title = pht('All Packages');
|
|
break;
|
|
case 'view/projects':
|
|
$title = pht('Projects');
|
|
break;
|
|
case 'new':
|
|
$title = pht('New Package');
|
|
break;
|
|
default:
|
|
$title = pht('Package');
|
|
break;
|
|
}
|
|
|
|
$crumbs = $this->buildApplicationCrumbs();
|
|
$crumbs->addTextCrumb($title);
|
|
|
|
$crumbs->addAction(
|
|
id(new PHUIListItemView())
|
|
->setName(pht('Create Package'))
|
|
->setHref('/owners/new/')
|
|
->setIcon('create'));
|
|
|
|
$nav->setCrumbs($crumbs);
|
|
|
|
return $nav;
|
|
}
|
|
|
|
public function buildApplicationMenu() {
|
|
return $this->buildSideNavView()->getMenu();
|
|
}
|
|
|
|
protected function getExtraPackageViews(AphrontSideNavFilterView $view) {
|
|
return;
|
|
}
|
|
|
|
}
|