mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-30 01:10:58 +01:00
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
This commit is contained in:
parent
ec7a0837d5
commit
328210a1a6
2 changed files with 34 additions and 13 deletions
|
@ -48,17 +48,29 @@ final class PhabricatorPonderApplication extends PhabricatorApplication {
|
||||||
|
|
||||||
public function getRoutes() {
|
public function getRoutes() {
|
||||||
return array(
|
return array(
|
||||||
'/Q(?P<id>[1-9]\d*)' => 'PonderQuestionViewController',
|
'/Q(?P<id>[1-9]\d*)'
|
||||||
|
=> 'PonderQuestionViewController',
|
||||||
'/ponder/' => array(
|
'/ponder/' => array(
|
||||||
'(?:query/(?P<queryKey>[^/]+)/)?' => 'PonderQuestionListController',
|
'(?:query/(?P<queryKey>[^/]+)/)?'
|
||||||
'answer/add/' => 'PonderAnswerSaveController',
|
=> 'PonderQuestionListController',
|
||||||
'answer/edit/(?P<id>\d+)/' => 'PonderAnswerEditController',
|
'answer/add/'
|
||||||
'answer/comment/(?P<id>\d+)/' => 'PonderAnswerCommentController',
|
=> 'PonderAnswerSaveController',
|
||||||
'answer/history/(?P<id>\d+)/' => 'PonderAnswerHistoryController',
|
'answer/edit/(?P<id>\d+)/'
|
||||||
'question/edit/(?:(?P<id>\d+)/)?' => 'PonderQuestionEditController',
|
=> 'PonderAnswerEditController',
|
||||||
'question/comment/(?P<id>\d+)/' => 'PonderQuestionCommentController',
|
'answer/comment/(?P<id>\d+)/'
|
||||||
'question/history/(?P<id>\d+)/' => 'PonderQuestionHistoryController',
|
=> 'PonderAnswerCommentController',
|
||||||
'preview/' => 'PhabricatorMarkupPreviewController',
|
'answer/history/(?P<id>\d+)/'
|
||||||
|
=> 'PonderAnswerHistoryController',
|
||||||
|
'question/edit/(?:(?P<id>\d+)/)?'
|
||||||
|
=> 'PonderQuestionEditController',
|
||||||
|
'question/create/'
|
||||||
|
=> 'PonderQuestionEditController',
|
||||||
|
'question/comment/(?P<id>\d+)/'
|
||||||
|
=> 'PonderQuestionCommentController',
|
||||||
|
'question/history/(?P<id>\d+)/'
|
||||||
|
=> 'PonderQuestionHistoryController',
|
||||||
|
'preview/'
|
||||||
|
=> 'PhabricatorMarkupPreviewController',
|
||||||
'question/(?P<status>open|close)/(?P<id>[1-9]\d*)/'
|
'question/(?P<status>open|close)/(?P<id>[1-9]\d*)/'
|
||||||
=> 'PonderQuestionStatusController',
|
=> 'PonderQuestionStatusController',
|
||||||
'vote/' => 'PonderVoteSaveController',
|
'vote/' => 'PonderVoteSaveController',
|
||||||
|
|
|
@ -2,12 +2,16 @@
|
||||||
|
|
||||||
abstract class PonderController extends PhabricatorController {
|
abstract class PonderController extends PhabricatorController {
|
||||||
|
|
||||||
protected function buildSideNavView() {
|
protected function buildSideNavView($for_app = false) {
|
||||||
$user = $this->getRequest()->getUser();
|
$user = $this->getRequest()->getUser();
|
||||||
|
|
||||||
$nav = new AphrontSideNavFilterView();
|
$nav = new AphrontSideNavFilterView();
|
||||||
$nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
|
$nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
|
||||||
|
|
||||||
|
if ($for_app) {
|
||||||
|
$nav->addFilter('question/create/', pht('Ask Question'));
|
||||||
|
}
|
||||||
|
|
||||||
id(new PonderQuestionSearchEngine())
|
id(new PonderQuestionSearchEngine())
|
||||||
->setViewer($user)
|
->setViewer($user)
|
||||||
->addNavigationItems($nav->getMenu());
|
->addNavigationItems($nav->getMenu());
|
||||||
|
@ -17,13 +21,18 @@ abstract class PonderController extends PhabricatorController {
|
||||||
return $nav;
|
return $nav;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function buildApplicationMenu() {
|
||||||
|
return $this->buildSideNavView($for_app = true)->getMenu();
|
||||||
|
}
|
||||||
|
|
||||||
protected function buildApplicationCrumbs() {
|
protected function buildApplicationCrumbs() {
|
||||||
$crumbs = parent::buildApplicationCrumbs();
|
$crumbs = parent::buildApplicationCrumbs();
|
||||||
|
$href = $this->getApplicationURI('question/create/');
|
||||||
$crumbs
|
$crumbs
|
||||||
->addAction(
|
->addAction(
|
||||||
id(new PHUIListItemView())
|
id(new PHUIListItemView())
|
||||||
->setName(pht('Create Question'))
|
->setName(pht('Ask Question'))
|
||||||
->setHref('/ponder/question/edit/')
|
->setHref($href)
|
||||||
->setIcon('fa-plus-square'));
|
->setIcon('fa-plus-square'));
|
||||||
|
|
||||||
return $crumbs;
|
return $crumbs;
|
||||||
|
|
Loading…
Reference in a new issue