1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-29 18:22:41 +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( return array(
'/diviner/' => array( '/diviner/' => array(
'' => 'DivinerMainController', '' => 'DivinerMainController',
'query/((?<key>[^/]+)/)?' => 'DivinerAtomListController', 'query/((?<queryKey>[^/]+)/)?' => 'DivinerAtomListController',
'find/' => 'DivinerFindController', 'find/' => 'DivinerFindController',
), ),
'/book/(?P<book>[^/]+)/' => 'DivinerBookController', '/book/(?P<book>[^/]+)/' => 'DivinerBookController',

View file

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

View file

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

View file

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

View file

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

View file

@ -2,28 +2,9 @@
abstract class PhabricatorFileController extends PhabricatorController { abstract class PhabricatorFileController extends PhabricatorController {
protected function buildSideNavView() {
$menu = $this->buildMenu($for_devices = false);
return AphrontSideNavFilterView::newFromMenu($menu);
}
public function buildApplicationMenu() { 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) { public function handleRequest(AphrontRequest $request) {
$controller = id(new PhabricatorApplicationSearchController()) return id(new PhabricatorFileSearchEngine())
->setQueryKey($request->getURIData('key')) ->setController($this)
->setSearchEngine(new PhabricatorFileSearchEngine()) ->buildResponse();
->setNavigation($this->buildSideNavView());
return $this->delegateToController($controller);
} }
protected function buildApplicationCrumbs() { protected function buildApplicationCrumbs() {
$crumbs = parent::buildApplicationCrumbs(); $crumbs = parent::buildApplicationCrumbs();
$crumbs->addAction( $crumbs->addAction(
id(new PHUIListItemView()) id(new PHUIListItemView())
->setName(pht('Upload File')) ->setName(pht('Upload File'))

View file

@ -46,13 +46,6 @@ final class AphrontSideNavFilterView extends AphrontView {
return $this; 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) { public function setCrumbs(PHUICrumbsView $crumbs) {
$this->crumbs = $crumbs; $this->crumbs = $crumbs;
return $this; return $this;