Page MenuHomestyx hydra

No OneTemporary

diff --git a/src/applications/ponder/controller/PonderAnswerSaveController.php b/src/applications/ponder/controller/PonderAnswerSaveController.php
index d350ceb0a8..57768cb41a 100644
--- a/src/applications/ponder/controller/PonderAnswerSaveController.php
+++ b/src/applications/ponder/controller/PonderAnswerSaveController.php
@@ -1,63 +1,62 @@
<?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 PonderAnswerSaveController extends PonderController {
public function processRequest() {
$request = $this->getRequest();
if (!$request->isFormPost()) {
return new Aphront400Response();
}
$user = $request->getUser();
$question_id = $request->getInt('question_id');
$question = PonderQuestionQuery::loadSingle($user, $question_id);
if (!$question) {
return new Aphront404Response();
}
$answer = $request->getStr('answer');
$content_source = PhabricatorContentSource::newForSource(
PhabricatorContentSource::SOURCE_WEB,
array(
'ip' => $request->getRemoteAddr(),
));
$res = new PonderAnswer();
$res
->setContent($answer)
->setAuthorPHID($user->getPHID())
->setVoteCount(0)
->setQuestionID($question_id)
->setContentSource($content_source);
id(new PonderAnswerEditor())
->setQuestion($question)
->setAnswer($res)
->saveAnswer();
PhabricatorSearchPonderIndexer::indexQuestion($question);
return id(new AphrontRedirectResponse())
->setURI(id(new PhutilURI('/Q'. $question->getID()))
- ->setFragment('A'.$res->getID()));
+ ->setFragment('A'.$res->getID()));
}
-
}
diff --git a/src/applications/ponder/view/PonderAddCommentView.php b/src/applications/ponder/view/PonderAddCommentView.php
index f4ed0248f3..2fdbf354df 100644
--- a/src/applications/ponder/view/PonderAddCommentView.php
+++ b/src/applications/ponder/view/PonderAddCommentView.php
@@ -1,70 +1,75 @@
<?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 PonderAddCommentView extends AphrontView {
private $target;
private $user;
private $actionURI;
private $questionID;
public function setTarget($target) {
$this->target = $target;
return $this;
}
public function setUser(PhabricatorUser $user) {
$this->user = $user;
return $this;
}
public function setQuestionID($id) {
$this->questionID = $id;
return $this;
}
public function setActionURI($uri) {
$this->actionURI = $uri;
return $this;
}
public function render() {
require_celerity_resource('ponder-comment-table-css');
$is_serious = PhabricatorEnv::getEnvConfig('phabricator.serious-business');
$questionID = $this->questionID;
$target = $this->target;
$form = new AphrontFormView();
$form
->setUser($this->user)
->setAction($this->actionURI)
->addHiddenInput('target', $target)
->addHiddenInput('question_id', $questionID)
->appendChild(
id(new AphrontFormTextAreaControl())
->setName('content')
->setEnableDragAndDropFileUploads(false))
->appendChild(
id(new AphrontFormSubmitControl())
->setValue($is_serious ? 'Submit' : 'Editorialize'));
- return $form->render();
+ $view = id(new AphrontMoreView())
+ ->setSome(id(new AphrontNullView())->render())
+ ->setMore($form->render())
+ ->setExpandText('Add Comment');
+
+ return $view->render();
}
}
diff --git a/src/view/layout/AphrontMoreView.php b/src/view/layout/AphrontMoreView.php
index 3406f4664d..fc63e04074 100644
--- a/src/view/layout/AphrontMoreView.php
+++ b/src/view/layout/AphrontMoreView.php
@@ -1,62 +1,68 @@
<?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 AphrontMoreView extends AphrontView {
private $some;
private $more;
+ private $expandtext;
public function setSome($some) {
$this->some = $some;
return $this;
}
public function setMore($more) {
$this->more = $more;
return $this;
}
+ public function setExpandText($text) {
+ $this->expandtext = $text;
+ return $this;
+ }
+
public function render() {
$some = $this->some;
+ $text = $this->expandtext === null ?: "(Show More\xE2\x80\xA6)";
+
$link = null;
if ($this->more && $this->more != $this->some) {
Javelin::initBehavior('aphront-more');
$link = ' '.javelin_render_tag(
'a',
array(
'sigil' => 'aphront-more-view-show-more',
'mustcapture' => true,
'href' => '#',
'meta' => array(
'more' => $this->more,
),
),
- "(Show More\xE2\x80\xA6)");
+ $text);
}
return javelin_render_tag(
'div',
array(
'sigil' => 'aphront-more-view',
),
$some.$link);
}
-
-
}

File Metadata

Mime Type
text/x-diff
Expires
Tue, Apr 28, 7:33 PM (1 d, 4 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1335711
Default Alt Text
(6 KB)

Event Timeline