Clean up some Ponder language

Summary:
Ref T9099.

 - Remove unused function
 - Fix celerity resource include
 - Add a note when an answer's been closed
 - Clean up architecture a little
 - Add a better notice when you've already answered.

Test Plan: Test with and without answers, with answering, with being closed.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Maniphest Tasks: T9099

Differential Revision: https://secure.phabricator.com/D13875
This commit is contained in:
Chad Little
2015-08-12 07:56:31 -07:00
parent f18537ce0b
commit 9a7beadd22
4 changed files with 35 additions and 60 deletions

View File

@@ -18,21 +18,10 @@ final class PonderQuestionViewController extends PonderController {
$answers = $this->buildAnswers($question->getAnswers());
$authors = mpull($question->getAnswers(), null, 'getAuthorPHID');
if (isset($authors[$viewer->getPHID()])) {
$answer_add_panel = id(new PHUIInfoView())
->setSeverity(PHUIInfoView::SEVERITY_NOTICE)
->appendChild(
pht(
'You have already answered this question. You can not answer '.
'twice, but you can edit your existing answer.'));
} else {
$answer_add_panel = new PonderAddAnswerView();
$answer_add_panel
->setQuestion($question)
->setUser($viewer)
->setActionURI('/ponder/answer/add/');
}
$answer_add_panel = id(new PonderAddAnswerView())
->setQuestion($question)
->setUser($viewer)
->setActionURI('/ponder/answer/add/');
$header = new PHUIHeaderView();
$header->setHeader($question->getTitle());
@@ -245,49 +234,6 @@ final class PonderQuestionViewController extends PonderController {
return $view;
}
private function wrapComments($n, $stuff) {
if ($n == 0) {
$text = pht('Add a Comment');
} else {
$text = pht('Show %s Comments', new PhutilNumber($n));
}
$show_id = celerity_generate_unique_node_id();
$hide_id = celerity_generate_unique_node_id();
Javelin::initBehavior('phabricator-reveal-content');
require_celerity_resource('ponder-view-css');
$show = phutil_tag(
'div',
array(
'id' => $show_id,
'class' => 'ponder-show-comments',
),
javelin_tag(
'a',
array(
'href' => '#',
'sigil' => 'reveal-content',
'meta' => array(
'showIDs' => array($hide_id),
'hideIDs' => array($show_id),
),
),
$text));
$hide = phutil_tag(
'div',
array(
'class' => 'ponder-comments-view',
'id' => $hide_id,
'style' => 'display: none',
),
$stuff);
return array($show, $hide);
}
private function buildSidebar(PonderQuestion $question) {
$viewer = $this->getViewer();
$status = $question->getStatus();