Page MenuHomestyx hydra

No OneTemporary

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
@@ -1,56 +1,64 @@
<?php
/*
* Copyright 2012 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
abstract class PonderController extends PhabricatorController {
public function buildStandardPageResponse($view, array $data) {
$page = $this->buildStandardPageView();
$page->setApplicationName('Ponder!');
$page->setBaseURI('/ponder/');
$page->setTitle(idx($data, 'title'));
$page->setGlyph("\xE2\x97\xB3");
$page->appendChild($view);
$page->setSearchDefaultScope(PhabricatorSearchScope::SCOPE_QUESTIONS);
$response = new AphrontWebpageResponse();
return $response->setContent($page->render());
}
protected function buildSideNavView(PonderQuestion $question = null) {
$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');
$side_nav->addSpacer();
$side_nav->addLabel('Questions');
$side_nav->addFilter('feed', 'All Questions');
$side_nav->addSpacer();
$side_nav->addLabel('User');
$side_nav->addFilter('questions', 'Your Questions');
$side_nav->addFilter('answers', 'Your Answers');
return $side_nav;
}
}
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
@@ -1,85 +1,92 @@
<?php
/*
* Copyright 2012 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
final class PonderQuestionViewController extends PonderController {
private $questionID;
public function willProcessRequest(array $data) {
$this->questionID = $data['id'];
}
public function processRequest() {
$request = $this->getRequest();
$user = $request->getUser();
$question = PonderQuestionQuery::loadSingle($user, $this->questionID);
if (!$question) {
return new Aphront404Response();
}
$question->attachRelated($user->getPHID());
$object_phids = array($user->getPHID(), $question->getAuthorPHID());
$answers = $question->getAnswers();
$comments = $question->getComments();
foreach ($comments as $comment) {
$object_phids[] = $comment->getAuthorPHID();
}
foreach ($answers as $answer) {
$object_phids[] = $answer->getAuthorPHID();
$comments = $answer->getComments();
foreach ($comments as $comment) {
$object_phids[] = $comment->getAuthorPHID();
}
}
$handles = $this->loadViewerHandles($object_phids);
$detail_panel = new PonderQuestionDetailView();
$detail_panel
->setQuestion($question)
->setUser($user)
->setHandles($handles);
$responses_panel = new PonderAnswerListView();
$responses_panel
->setQuestion($question)
->setHandles($handles)
->setUser($user)
->setAnswers($answers);
$answer_add_panel = new PonderAddAnswerView();
$answer_add_panel
->setQuestion($question)
->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
@@ -1,89 +1,96 @@
<?php
/*
* Copyright 2012 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
final class PonderAddAnswerView extends AphrontView {
private $question;
private $user;
private $actionURI;
private $draft;
public function setQuestion($question) {
$this->question = $question;
return $this;
}
public function setUser(PhabricatorUser $user) {
$this->user = $user;
return $this;
}
public function setActionURI($uri) {
$this->actionURI = $uri;
return $this;
}
public function render() {
require_celerity_resource('ponder-core-view-css');
$is_serious = PhabricatorEnv::getEnvConfig('phabricator.serious-business');
$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)
->addHiddenInput('question_id', $question->getID())
->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 =
'<div class="aphront-panel-flush">'.
'<div id="answer-preview">'.
'<span class="aphront-panel-preview-loading-text">'.
'Loading answer preview...'.
'</span>'.
'</div>'.
- '</div>'
- );
+ '</div>';
Javelin::initBehavior(
'ponder-feedback-preview',
array(
'uri' => '/ponder/answer/preview/',
'content' => 'answer-content',
'preview' => 'answer-preview',
'question_id' => $question->getID()
));
- return $panel->render();
+ return id(new AphrontNullView())
+ ->appendChild(
+ array(
+ $header,
+ $form,
+ $preview,
+ ))
+ ->render();
}
}

File Metadata

Mime Type
text/x-diff
Expires
Sat, Nov 15, 1:40 AM (20 h, 59 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
337489
Default Alt Text
(8 KB)

Event Timeline