From e48fa0398bf6d16b36cbe3baa0c59a9e2f1b56c8 Mon Sep 17 00:00:00 2001 From: epriestley Date: Sun, 30 Sep 2012 20:12:18 -0700 Subject: [PATCH] Use responsive elements for Ponder "add answer" view Summary: Side nav, plus "add answer". Test Plan: {F19533} Reviewers: pieter, starruler Reviewed By: pieter CC: aran Maniphest Tasks: T1644 Differential Revision: https://secure.phabricator.com/D3516 --- .../ponder/controller/PonderController.php | 8 +++++++ .../PonderQuestionViewController.php | 11 +++++++-- .../ponder/view/PonderAddAnswerView.php | 23 ++++++++++++------- 3 files changed, 32 insertions(+), 10 deletions(-) diff --git a/src/applications/ponder/controller/PonderController.php b/src/applications/ponder/controller/PonderController.php index b93c38d416..b8625d0a3d 100644 --- a/src/applications/ponder/controller/PonderController.php +++ b/src/applications/ponder/controller/PonderController.php @@ -36,6 +36,14 @@ abstract class PonderController extends PhabricatorController { $side_nav = new AphrontSideNavFilterView(); $side_nav->setBaseURI(new PhutilURI($this->getApplicationURI())); + if ($question && $question->getID()) { + $side_nav->addFilter( + null, + 'Q'.$question->getID(), + 'Q'.$question->getID()); + $side_nav->addSpacer(); + } + $side_nav->addLabel('Create'); $side_nav->addFilter('question/ask', 'Ask a Question'); diff --git a/src/applications/ponder/controller/PonderQuestionViewController.php b/src/applications/ponder/controller/PonderQuestionViewController.php index b15ac7d027..420d4b01c1 100644 --- a/src/applications/ponder/controller/PonderQuestionViewController.php +++ b/src/applications/ponder/controller/PonderQuestionViewController.php @@ -72,13 +72,20 @@ final class PonderQuestionViewController extends PonderController { ->setUser($user) ->setActionURI("/ponder/answer/add/"); - return $this->buildStandardPageResponse( + $nav = $this->buildSideNavView($question); + $nav->appendChild( array( $detail_panel, $responses_panel, $answer_add_panel - ), + )); + $nav->selectFilter(null); + + + return $this->buildApplicationPage( + $nav, array( + 'device' => true, 'title' => 'Q'.$question->getID().' '.$question->getTitle() )); } diff --git a/src/applications/ponder/view/PonderAddAnswerView.php b/src/applications/ponder/view/PonderAddAnswerView.php index c1604ea7b2..3acbfe1431 100644 --- a/src/applications/ponder/view/PonderAddAnswerView.php +++ b/src/applications/ponder/view/PonderAddAnswerView.php @@ -45,12 +45,12 @@ final class PonderAddAnswerView extends AphrontView { $question = $this->question; - $panel = id(new AphrontPanelView()) - ->addClass("ponder-panel") - ->setHeader("Your Answer:"); + $header = id(new PhabricatorHeaderView()) + ->setHeader('Add Answer'); $form = new AphrontFormView(); $form + ->setFlexible(true) ->setUser($this->user) ->setAction($this->actionURI) ->setWorkflow(true) @@ -58,22 +58,22 @@ final class PonderAddAnswerView extends AphrontView { ->appendChild( id(new PhabricatorRemarkupControl()) ->setName('answer') + ->setLabel('Answer') + ->setError(true) ->setID('answer-content') ->setEnableDragAndDropFileUploads(true)) ->appendChild( id(new AphrontFormSubmitControl()) ->setValue($is_serious ? 'Submit' : 'Make it so.')); - $panel->appendChild($form); - $panel->appendChild( + $preview = '
'. '
'. ''. 'Loading answer preview...'. ''. '
'. - '
' - ); + ''; Javelin::initBehavior( 'ponder-feedback-preview', @@ -84,6 +84,13 @@ final class PonderAddAnswerView extends AphrontView { 'question_id' => $question->getID() )); - return $panel->render(); + return id(new AphrontNullView()) + ->appendChild( + array( + $header, + $form, + $preview, + )) + ->render(); } }