mirror of
https://we.phorge.it/source/phorge.git
synced 2025-02-27 14:09:11 +01:00
Hide Ponder comments and "add comment" form behind a disclosure link
Summary: Ref T3373. This is probably about as good as I can get without actual design, but it seems mostly improved over what we had going on before? Test Plan: {F52087} Reviewers: btrahan, chad Reviewed By: chad CC: aran Maniphest Tasks: T3373 Differential Revision: https://secure.phabricator.com/D6613
This commit is contained in:
parent
644f377915
commit
ba8803af96
4 changed files with 71 additions and 31 deletions
|
@ -3893,7 +3893,7 @@ celerity_register_resource_map(array(
|
|||
),
|
||||
'ponder-comment-table-css' =>
|
||||
array(
|
||||
'uri' => '/res/15cb54fb/rsrc/css/application/ponder/comments.css',
|
||||
'uri' => '/res/2527ba37/rsrc/css/application/ponder/comments.css',
|
||||
'type' => 'css',
|
||||
'requires' =>
|
||||
array(
|
||||
|
|
|
@ -29,9 +29,12 @@ final class PonderQuestionViewController extends PonderController {
|
|||
|
||||
$authors = mpull($question->getAnswers(), null, 'getAuthorPHID');
|
||||
if (isset($authors[$user->getPHID()])) {
|
||||
// TODO: Make this pretty
|
||||
$answer_add_panel = pht(
|
||||
'You have already answered this question.');
|
||||
$answer_add_panel = id(new AphrontErrorView())
|
||||
->setSeverity(AphrontErrorView::SEVERITY_NODATA)
|
||||
->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
|
||||
|
@ -190,10 +193,12 @@ final class PonderQuestionViewController extends PonderController {
|
|||
->setAction($this->getApplicationURI("/question/comment/{$id}/"))
|
||||
->setSubmitButtonName(pht('Comment'));
|
||||
|
||||
return array(
|
||||
return $this->wrapComments(
|
||||
count($xactions),
|
||||
array(
|
||||
$timeline,
|
||||
$add_comment,
|
||||
);
|
||||
));
|
||||
}
|
||||
|
||||
private function buildAnswers(array $answers) {
|
||||
|
@ -238,18 +243,24 @@ final class PonderQuestionViewController extends PonderController {
|
|||
$out[] = $this->buildAnswerActions($answer);
|
||||
$out[] = $this->buildAnswerProperties($answer);
|
||||
|
||||
$out[] = id(new PhabricatorApplicationTransactionView())
|
||||
$details = array();
|
||||
|
||||
$details[] = id(new PhabricatorApplicationTransactionView())
|
||||
->setUser($viewer)
|
||||
->setObjectPHID($answer->getPHID())
|
||||
->setTransactions($xactions)
|
||||
->setMarkupEngine($engine);
|
||||
|
||||
$out[] = id(new PhabricatorApplicationTransactionCommentView())
|
||||
$details[] = id(new PhabricatorApplicationTransactionCommentView())
|
||||
->setUser($viewer)
|
||||
->setObjectPHID($answer->getPHID())
|
||||
->setShowPreview(false)
|
||||
->setAction($this->getApplicationURI("/answer/comment/{$id}/"))
|
||||
->setSubmitButtonName(pht('Comment'));
|
||||
|
||||
$out[] = $this->wrapComments(
|
||||
count($xactions),
|
||||
$details);
|
||||
}
|
||||
|
||||
$out[] = phutil_tag('br');
|
||||
|
@ -317,4 +328,46 @@ 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-comment-table-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(
|
||||
'id' => $hide_id,
|
||||
'style' => 'display: none',
|
||||
),
|
||||
$stuff);
|
||||
|
||||
return array($show, $hide);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -44,32 +44,11 @@ final class PonderAddAnswerView extends AphrontView {
|
|||
pht('Submit') :
|
||||
pht('Make it so')));
|
||||
|
||||
$loading = pht('Loading answer preview...');
|
||||
$preview = hsprintf(
|
||||
'<div class="aphront-panel-flush">'.
|
||||
'<div id="answer-preview">'.
|
||||
'<span class="aphront-panel-preview-loading-text">'.
|
||||
'%s'.
|
||||
'</span>'.
|
||||
'</div>'.
|
||||
'</div>',
|
||||
$loading);
|
||||
|
||||
Javelin::initBehavior(
|
||||
'ponder-feedback-preview',
|
||||
array(
|
||||
'uri' => '/ponder/answer/preview/',
|
||||
'content' => 'answer-content',
|
||||
'preview' => 'answer-preview',
|
||||
'question_id' => $question->getID()
|
||||
));
|
||||
|
||||
return id(new AphrontNullView())
|
||||
->appendChild(
|
||||
array(
|
||||
$header,
|
||||
$form,
|
||||
$preview,
|
||||
))
|
||||
->render();
|
||||
}
|
||||
|
|
|
@ -2,6 +2,14 @@
|
|||
* @provides ponder-comment-table-css
|
||||
*/
|
||||
|
||||
.ponder-show-comments {
|
||||
text-align: center;
|
||||
padding: 8px 0;
|
||||
font-weight: bold;
|
||||
background: #f9f9f9;
|
||||
box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
|
||||
border-bottom: 1px solid #b7b7b7;
|
||||
}
|
||||
|
||||
.ponder-comments {
|
||||
width: 480px;
|
||||
|
|
Loading…
Add table
Reference in a new issue