1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 08:52:39 +01:00

Remove newFromMenu() from SideNav

Summary: Ref T10054. Just simplifying this a bit before I start laying in the new profile menus.

Test Plan:
  - Viewed Diviner on desktop and checked the mobile menu.
  - Viewed Files on desktop and checked the mobile menu.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T10054

Differential Revision: https://secure.phabricator.com/D15015
This commit is contained in:
epriestley 2016-01-13 15:58:05 -08:00
parent 473693786b
commit 3f439e25bc
8 changed files with 14 additions and 57 deletions

View file

@ -35,7 +35,7 @@ final class PhabricatorDivinerApplication extends PhabricatorApplication {
return array(
'/diviner/' => array(
'' => 'DivinerMainController',
'query/((?<key>[^/]+)/)?' => 'DivinerAtomListController',
'query/((?<queryKey>[^/]+)/)?' => 'DivinerAtomListController',
'find/' => 'DivinerFindController',
),
'/book/(?P<book>[^/]+)/' => 'DivinerBookController',

View file

@ -7,14 +7,9 @@ final class DivinerAtomListController extends DivinerController {
}
public function handleRequest(AphrontRequest $request) {
$query_key = $request->getURIData('key');
$controller = id(new PhabricatorApplicationSearchController())
->setQueryKey($query_key)
->setSearchEngine(new DivinerAtomSearchEngine())
->setNavigation($this->buildSideNavView());
return $this->delegateToController($controller);
return id(new DivinerAtomSearchEngine())
->setController($this)
->buildResponse();
}
}

View file

@ -2,19 +2,9 @@
abstract class DivinerController extends PhabricatorController {
protected function buildSideNavView() {
$menu = $this->buildApplicationMenu();
return AphrontSideNavFilterView::newFromMenu($menu);
}
public function buildApplicationMenu() {
$menu = new PHUIListView();
id(new DivinerAtomSearchEngine())
->setViewer($this->getRequest()->getViewer())
->addNavigationItems($menu);
return $menu;
return $this->newApplicationMenu()
->setSearchEngine(new DivinerAtomSearchEngine());
}
protected function renderAtomList(array $symbols) {

View file

@ -103,7 +103,7 @@ final class DivinerAtomSearchEngine extends PhabricatorApplicationSearchEngine {
protected function getBuiltinQueryNames() {
return array(
'all' => pht('All'),
'all' => pht('All Atoms'),
);
}

View file

@ -70,7 +70,7 @@ final class PhabricatorFilesApplication extends PhabricatorApplication {
return array(
'/F(?P<id>[1-9]\d*)' => 'PhabricatorFileInfoController',
'/file/' => array(
'(query/(?P<key>[^/]+)/)?' => 'PhabricatorFileListController',
'(query/(?P<queryKey>[^/]+)/)?' => 'PhabricatorFileListController',
'upload/' => 'PhabricatorFileUploadController',
'dropupload/' => 'PhabricatorFileDropUploadController',
'compose/' => 'PhabricatorFileComposeController',

View file

@ -2,28 +2,9 @@
abstract class PhabricatorFileController extends PhabricatorController {
protected function buildSideNavView() {
$menu = $this->buildMenu($for_devices = false);
return AphrontSideNavFilterView::newFromMenu($menu);
}
public function buildApplicationMenu() {
return $this->buildMenu($for_devices = true);
return $this->newApplicationMenu()
->setSearchEngine(new PhabricatorFileSearchEngine());
}
private function buildMenu($for_devices) {
$menu = new PHUIListView();
if ($for_devices) {
$menu->newLink(pht('Upload File'), $this->getApplicationURI('/upload/'));
}
id(new PhabricatorFileSearchEngine())
->setViewer($this->getRequest()->getUser())
->addNavigationItems($menu);
return $menu;
}
}

View file

@ -11,16 +11,14 @@ final class PhabricatorFileListController extends PhabricatorFileController {
}
public function handleRequest(AphrontRequest $request) {
$controller = id(new PhabricatorApplicationSearchController())
->setQueryKey($request->getURIData('key'))
->setSearchEngine(new PhabricatorFileSearchEngine())
->setNavigation($this->buildSideNavView());
return $this->delegateToController($controller);
return id(new PhabricatorFileSearchEngine())
->setController($this)
->buildResponse();
}
protected function buildApplicationCrumbs() {
$crumbs = parent::buildApplicationCrumbs();
$crumbs->addAction(
id(new PHUIListItemView())
->setName(pht('Upload File'))

View file

@ -46,13 +46,6 @@ final class AphrontSideNavFilterView extends AphrontView {
return $this;
}
public static function newFromMenu(PHUIListView $menu) {
$object = new AphrontSideNavFilterView();
$object->setBaseURI(new PhutilURI('/'));
$object->menu = $menu;
return $object;
}
public function setCrumbs(PHUICrumbsView $crumbs) {
$this->crumbs = $crumbs;
return $this;