Correct a parameter order swap in "diffusion.historyquery" for Mercurial
[phabricator.git] / src / applications / spaces / controller / PhabricatorSpacesListController.php
blobc270171574ede86ba31814baffef17b306bae082
1 <?php
3 final class PhabricatorSpacesListController
4 extends PhabricatorSpacesController {
6 public function shouldAllowPublic() {
7 return true;
10 public function handleRequest(AphrontRequest $request) {
11 $request = $this->getRequest();
12 $controller = id(new PhabricatorApplicationSearchController())
13 ->setQueryKey($request->getURIData('queryKey'))
14 ->setSearchEngine(new PhabricatorSpacesNamespaceSearchEngine())
15 ->setNavigation($this->buildSideNavView());
17 return $this->delegateToController($controller);
20 public function buildSideNavView($for_app = false) {
21 $user = $this->getRequest()->getUser();
23 $nav = new AphrontSideNavFilterView();
24 $nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
26 id(new PhabricatorSpacesNamespaceSearchEngine())
27 ->setViewer($user)
28 ->addNavigationItems($nav->getMenu());
30 $nav->selectFilter(null);
32 return $nav;
35 protected function buildApplicationCrumbs() {
36 $crumbs = parent::buildApplicationCrumbs();
38 $can_create = $this->hasApplicationCapability(
39 PhabricatorSpacesCapabilityCreateSpaces::CAPABILITY);
41 $crumbs->addAction(
42 id(new PHUIListItemView())
43 ->setName(pht('Create Space'))
44 ->setHref($this->getApplicationURI('create/'))
45 ->setIcon('fa-plus-square')
46 ->setDisabled(!$can_create)
47 ->setWorkflow(!$can_create));
49 return $crumbs;