From 328210a1a645de4f3981d04fe786d4f7a3c6550c Mon Sep 17 00:00:00 2001 From: Chad Little Date: Tue, 4 Aug 2015 10:48:48 -0700 Subject: [PATCH] Add mobile menu to Ponder Summary: Ref T3578, adds mobile menus to Ponder Test Plan: Test Ponder on mobile and desktop, click in Ask Question links Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Maniphest Tasks: T3578 Differential Revision: https://secure.phabricator.com/D13784 --- .../PhabricatorPonderApplication.php | 32 +++++++++++++------ .../ponder/controller/PonderController.php | 15 +++++++-- 2 files changed, 34 insertions(+), 13 deletions(-) diff --git a/src/applications/ponder/application/PhabricatorPonderApplication.php b/src/applications/ponder/application/PhabricatorPonderApplication.php index 999580e90b..953f683128 100644 --- a/src/applications/ponder/application/PhabricatorPonderApplication.php +++ b/src/applications/ponder/application/PhabricatorPonderApplication.php @@ -48,17 +48,29 @@ final class PhabricatorPonderApplication extends PhabricatorApplication { public function getRoutes() { return array( - '/Q(?P[1-9]\d*)' => 'PonderQuestionViewController', + '/Q(?P[1-9]\d*)' + => 'PonderQuestionViewController', '/ponder/' => array( - '(?:query/(?P[^/]+)/)?' => 'PonderQuestionListController', - 'answer/add/' => 'PonderAnswerSaveController', - 'answer/edit/(?P\d+)/' => 'PonderAnswerEditController', - 'answer/comment/(?P\d+)/' => 'PonderAnswerCommentController', - 'answer/history/(?P\d+)/' => 'PonderAnswerHistoryController', - 'question/edit/(?:(?P\d+)/)?' => 'PonderQuestionEditController', - 'question/comment/(?P\d+)/' => 'PonderQuestionCommentController', - 'question/history/(?P\d+)/' => 'PonderQuestionHistoryController', - 'preview/' => 'PhabricatorMarkupPreviewController', + '(?:query/(?P[^/]+)/)?' + => 'PonderQuestionListController', + 'answer/add/' + => 'PonderAnswerSaveController', + 'answer/edit/(?P\d+)/' + => 'PonderAnswerEditController', + 'answer/comment/(?P\d+)/' + => 'PonderAnswerCommentController', + 'answer/history/(?P\d+)/' + => 'PonderAnswerHistoryController', + 'question/edit/(?:(?P\d+)/)?' + => 'PonderQuestionEditController', + 'question/create/' + => 'PonderQuestionEditController', + 'question/comment/(?P\d+)/' + => 'PonderQuestionCommentController', + 'question/history/(?P\d+)/' + => 'PonderQuestionHistoryController', + 'preview/' + => 'PhabricatorMarkupPreviewController', 'question/(?Popen|close)/(?P[1-9]\d*)/' => 'PonderQuestionStatusController', 'vote/' => 'PonderVoteSaveController', diff --git a/src/applications/ponder/controller/PonderController.php b/src/applications/ponder/controller/PonderController.php index 30bd412504..a14d70c773 100644 --- a/src/applications/ponder/controller/PonderController.php +++ b/src/applications/ponder/controller/PonderController.php @@ -2,12 +2,16 @@ abstract class PonderController extends PhabricatorController { - protected function buildSideNavView() { + protected function buildSideNavView($for_app = false) { $user = $this->getRequest()->getUser(); $nav = new AphrontSideNavFilterView(); $nav->setBaseURI(new PhutilURI($this->getApplicationURI())); + if ($for_app) { + $nav->addFilter('question/create/', pht('Ask Question')); + } + id(new PonderQuestionSearchEngine()) ->setViewer($user) ->addNavigationItems($nav->getMenu()); @@ -17,13 +21,18 @@ abstract class PonderController extends PhabricatorController { return $nav; } + public function buildApplicationMenu() { + return $this->buildSideNavView($for_app = true)->getMenu(); + } + protected function buildApplicationCrumbs() { $crumbs = parent::buildApplicationCrumbs(); + $href = $this->getApplicationURI('question/create/'); $crumbs ->addAction( id(new PHUIListItemView()) - ->setName(pht('Create Question')) - ->setHref('/ponder/question/edit/') + ->setName(pht('Ask Question')) + ->setHref($href) ->setIcon('fa-plus-square')); return $crumbs;