1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-24 06:20:56 +01:00

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

@ -41,7 +41,7 @@ final class PonderQuestionStatus extends PonderConstants {
self::STATUS_OPEN =>
pht('This question is open for answers.'),
self::STATUS_CLOSED_RESOLVED =>
pht('This question has been resolved.'),
pht('This question has been answered or resolved.'),
self::STATUS_CLOSED_OBSOLETE =>
pht('This question is no longer valid or out of date.'),
self::STATUS_CLOSED_DUPLICATE =>

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
$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();

View file

@ -18,6 +18,28 @@ final class PonderAddAnswerView extends AphrontView {
public function render() {
$question = $this->question;
$viewer = $this->user;
$authors = mpull($question->getAnswers(), null, 'getAuthorPHID');
if (isset($authors[$viewer->getPHID()])) {
return id(new PHUIInfoView())
->setSeverity(PHUIInfoView::SEVERITY_NOTICE)
->setTitle(pht('Already Answered'))
->appendChild(
pht(
'You have already answered this question. You can not answer '.
'twice, but you can edit your existing answer.'));
}
$info_panel = null;
if ($question->getStatus() != PonderQuestionStatus::STATUS_OPEN) {
$info_panel = id(new PHUIInfoView())
->setSeverity(PHUIInfoView::SEVERITY_WARNING)
->appendChild(
pht(
'This question has been marked as closed,
but you can still leave a new answer.'));
}
$header = id(new PHUIHeaderView())
->setHeader(pht('Add Answer'));
@ -39,8 +61,14 @@ final class PonderAddAnswerView extends AphrontView {
id(new AphrontFormSubmitControl())
->setValue(pht('Add Answer')));
return id(new PHUIObjectBoxView())
$box = id(new PHUIObjectBoxView())
->setHeader($header)
->appendChild($form);
if ($info_panel) {
$box->setInfoView($info_panel);
}
return $box;
}
}

View file

@ -28,6 +28,7 @@ final class PonderFooterView extends AphrontTagView {
}
protected function getTagContent() {
require_celerity_resource('ponder-view-css');
Javelin::initBehavior('phabricator-reveal-content');
$hide_action_id = celerity_generate_unique_node_id();