1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-28 16:30:59 +01:00

Restore voting to Ponder

Summary: Ref T3578. Restores the voting UI and makes it a little prettier.

Test Plan: {F52089}

Reviewers: btrahan, chad

Reviewed By: chad

CC: aran

Maniphest Tasks: T3578

Differential Revision: https://secure.phabricator.com/D6614
This commit is contained in:
epriestley 2013-07-28 19:28:00 -07:00
parent ba8803af96
commit 5037ba1cf8
16 changed files with 190 additions and 428 deletions

View file

@ -3432,7 +3432,7 @@ celerity_register_resource_map(array(
),
'phabricator-property-list-view-css' =>
array(
'uri' => '/res/a04cc81d/rsrc/css/layout/phabricator-property-list-view.css',
'uri' => '/res/1b2f0fa9/rsrc/css/layout/phabricator-property-list-view.css',
'type' => 'css',
'requires' =>
array(
@ -3920,7 +3920,7 @@ celerity_register_resource_map(array(
),
'ponder-vote-css' =>
array(
'uri' => '/res/26945177/rsrc/css/application/ponder/vote.css',
'uri' => '/res/28b71b13/rsrc/css/application/ponder/vote.css',
'type' => 'css',
'requires' =>
array(
@ -4191,7 +4191,7 @@ celerity_register_resource_map(array(
), array(
'packages' =>
array(
'bbc1cd98' =>
'4bd2b460' =>
array(
'name' => 'core.pkg.css',
'symbols' =>
@ -4239,7 +4239,7 @@ celerity_register_resource_map(array(
40 => 'phabricator-property-list-view-css',
41 => 'phabricator-tag-view-css',
),
'uri' => '/res/pkg/bbc1cd98/core.pkg.css',
'uri' => '/res/pkg/4bd2b460/core.pkg.css',
'type' => 'css',
),
'75ccea43' =>
@ -4430,16 +4430,16 @@ celerity_register_resource_map(array(
),
'reverse' =>
array(
'aphront-dialog-view-css' => 'bbc1cd98',
'aphront-error-view-css' => 'bbc1cd98',
'aphront-form-view-css' => 'bbc1cd98',
'aphront-list-filter-view-css' => 'bbc1cd98',
'aphront-pager-view-css' => 'bbc1cd98',
'aphront-panel-view-css' => 'bbc1cd98',
'aphront-table-view-css' => 'bbc1cd98',
'aphront-tokenizer-control-css' => 'bbc1cd98',
'aphront-tooltip-css' => 'bbc1cd98',
'aphront-typeahead-control-css' => 'bbc1cd98',
'aphront-dialog-view-css' => '4bd2b460',
'aphront-error-view-css' => '4bd2b460',
'aphront-form-view-css' => '4bd2b460',
'aphront-list-filter-view-css' => '4bd2b460',
'aphront-pager-view-css' => '4bd2b460',
'aphront-panel-view-css' => '4bd2b460',
'aphront-table-view-css' => '4bd2b460',
'aphront-tokenizer-control-css' => '4bd2b460',
'aphront-tooltip-css' => '4bd2b460',
'aphront-typeahead-control-css' => '4bd2b460',
'differential-changeset-view-css' => 'dd27a69b',
'differential-core-view-css' => 'dd27a69b',
'differential-inline-comment-editor' => '48040be9',
@ -4453,7 +4453,7 @@ celerity_register_resource_map(array(
'differential-table-of-contents-css' => 'dd27a69b',
'diffusion-commit-view-css' => 'c8ce2d88',
'diffusion-icons-css' => 'c8ce2d88',
'global-drag-and-drop-css' => 'bbc1cd98',
'global-drag-and-drop-css' => '4bd2b460',
'inline-comment-summary-css' => 'dd27a69b',
'javelin-aphlict' => '75ccea43',
'javelin-behavior' => 'a9f14d76',
@ -4526,55 +4526,55 @@ celerity_register_resource_map(array(
'javelin-util' => 'a9f14d76',
'javelin-vector' => 'a9f14d76',
'javelin-workflow' => 'a9f14d76',
'lightbox-attachment-css' => 'bbc1cd98',
'lightbox-attachment-css' => '4bd2b460',
'maniphest-task-summary-css' => '06bacb9a',
'maniphest-transaction-detail-css' => '06bacb9a',
'phabricator-action-list-view-css' => 'bbc1cd98',
'phabricator-application-launch-view-css' => 'bbc1cd98',
'phabricator-action-list-view-css' => '4bd2b460',
'phabricator-application-launch-view-css' => '4bd2b460',
'phabricator-busy' => '75ccea43',
'phabricator-content-source-view-css' => 'dd27a69b',
'phabricator-core-css' => 'bbc1cd98',
'phabricator-crumbs-view-css' => 'bbc1cd98',
'phabricator-core-css' => '4bd2b460',
'phabricator-crumbs-view-css' => '4bd2b460',
'phabricator-drag-and-drop-file-upload' => '48040be9',
'phabricator-dropdown-menu' => '75ccea43',
'phabricator-file-upload' => '75ccea43',
'phabricator-filetree-view-css' => 'bbc1cd98',
'phabricator-flag-css' => 'bbc1cd98',
'phabricator-form-view-css' => 'bbc1cd98',
'phabricator-header-view-css' => 'bbc1cd98',
'phabricator-filetree-view-css' => '4bd2b460',
'phabricator-flag-css' => '4bd2b460',
'phabricator-form-view-css' => '4bd2b460',
'phabricator-header-view-css' => '4bd2b460',
'phabricator-hovercard' => '75ccea43',
'phabricator-jump-nav' => 'bbc1cd98',
'phabricator-jump-nav' => '4bd2b460',
'phabricator-keyboard-shortcut' => '75ccea43',
'phabricator-keyboard-shortcut-manager' => '75ccea43',
'phabricator-main-menu-view' => 'bbc1cd98',
'phabricator-main-menu-view' => '4bd2b460',
'phabricator-menu-item' => '75ccea43',
'phabricator-nav-view-css' => 'bbc1cd98',
'phabricator-nav-view-css' => '4bd2b460',
'phabricator-notification' => '75ccea43',
'phabricator-notification-css' => 'bbc1cd98',
'phabricator-notification-menu-css' => 'bbc1cd98',
'phabricator-object-item-list-view-css' => 'bbc1cd98',
'phabricator-notification-css' => '4bd2b460',
'phabricator-notification-menu-css' => '4bd2b460',
'phabricator-object-item-list-view-css' => '4bd2b460',
'phabricator-object-selector-css' => 'dd27a69b',
'phabricator-phtize' => '75ccea43',
'phabricator-prefab' => '75ccea43',
'phabricator-project-tag-css' => '06bacb9a',
'phabricator-property-list-view-css' => 'bbc1cd98',
'phabricator-remarkup-css' => 'bbc1cd98',
'phabricator-property-list-view-css' => '4bd2b460',
'phabricator-remarkup-css' => '4bd2b460',
'phabricator-shaped-request' => '48040be9',
'phabricator-side-menu-view-css' => 'bbc1cd98',
'phabricator-standard-page-view' => 'bbc1cd98',
'phabricator-tag-view-css' => 'bbc1cd98',
'phabricator-side-menu-view-css' => '4bd2b460',
'phabricator-standard-page-view' => '4bd2b460',
'phabricator-tag-view-css' => '4bd2b460',
'phabricator-textareautils' => '75ccea43',
'phabricator-tooltip' => '75ccea43',
'phabricator-transaction-view-css' => 'bbc1cd98',
'phabricator-zindex-css' => 'bbc1cd98',
'phui-button-css' => 'bbc1cd98',
'phui-form-css' => 'bbc1cd98',
'phui-icon-view-css' => 'bbc1cd98',
'phui-spacing-css' => 'bbc1cd98',
'sprite-apps-large-css' => 'bbc1cd98',
'sprite-gradient-css' => 'bbc1cd98',
'sprite-icons-css' => 'bbc1cd98',
'sprite-menu-css' => 'bbc1cd98',
'syntax-highlighting-css' => 'bbc1cd98',
'phabricator-transaction-view-css' => '4bd2b460',
'phabricator-zindex-css' => '4bd2b460',
'phui-button-css' => '4bd2b460',
'phui-form-css' => '4bd2b460',
'phui-icon-view-css' => '4bd2b460',
'phui-spacing-css' => '4bd2b460',
'sprite-apps-large-css' => '4bd2b460',
'sprite-gradient-css' => '4bd2b460',
'sprite-icons-css' => '4bd2b460',
'sprite-menu-css' => '4bd2b460',
'syntax-highlighting-css' => '4bd2b460',
),
));

View file

@ -1868,13 +1868,11 @@ phutil_register_library_map(array(
'PhrictionSearchEngine' => 'applications/phriction/query/PhrictionSearchEngine.php',
'PhrictionSearchIndexer' => 'applications/phriction/search/PhrictionSearchIndexer.php',
'PonderAddAnswerView' => 'applications/ponder/view/PonderAddAnswerView.php',
'PonderAddCommentView' => 'applications/ponder/view/PonderAddCommentView.php',
'PonderAnswer' => 'applications/ponder/storage/PonderAnswer.php',
'PonderAnswerCommentController' => 'applications/ponder/controller/PonderAnswerCommentController.php',
'PonderAnswerEditController' => 'applications/ponder/controller/PonderAnswerEditController.php',
'PonderAnswerEditor' => 'applications/ponder/editor/PonderAnswerEditor.php',
'PonderAnswerHistoryController' => 'applications/ponder/controller/PonderAnswerHistoryController.php',
'PonderAnswerListView' => 'applications/ponder/view/PonderAnswerListView.php',
'PonderAnswerQuery' => 'applications/ponder/query/PonderAnswerQuery.php',
'PonderAnswerSaveController' => 'applications/ponder/controller/PonderAnswerSaveController.php',
'PonderAnswerTransaction' => 'applications/ponder/storage/PonderAnswerTransaction.php',
@ -1884,7 +1882,6 @@ phutil_register_library_map(array(
'PonderAnsweredMail' => 'applications/ponder/mail/PonderAnsweredMail.php',
'PonderComment' => 'applications/ponder/storage/PonderComment.php',
'PonderCommentEditor' => 'applications/ponder/editor/PonderCommentEditor.php',
'PonderCommentListView' => 'applications/ponder/view/PonderCommentListView.php',
'PonderCommentMail' => 'applications/ponder/mail/PonderCommentMail.php',
'PonderCommentQuery' => 'applications/ponder/query/PonderCommentQuery.php',
'PonderConstants' => 'applications/ponder/constants/PonderConstants.php',
@ -1898,7 +1895,6 @@ phutil_register_library_map(array(
'PonderPostBodyView' => 'applications/ponder/view/PonderPostBodyView.php',
'PonderQuestion' => 'applications/ponder/storage/PonderQuestion.php',
'PonderQuestionCommentController' => 'applications/ponder/controller/PonderQuestionCommentController.php',
'PonderQuestionDetailView' => 'applications/ponder/view/PonderQuestionDetailView.php',
'PonderQuestionEditController' => 'applications/ponder/controller/PonderQuestionEditController.php',
'PonderQuestionEditor' => 'applications/ponder/editor/PonderQuestionEditor.php',
'PonderQuestionHistoryController' => 'applications/ponder/controller/PonderQuestionHistoryController.php',
@ -3986,7 +3982,6 @@ phutil_register_library_map(array(
'PhrictionSearchEngine' => 'PhabricatorApplicationSearchEngine',
'PhrictionSearchIndexer' => 'PhabricatorSearchDocumentIndexer',
'PonderAddAnswerView' => 'AphrontView',
'PonderAddCommentView' => 'AphrontView',
'PonderAnswer' =>
array(
0 => 'PonderDAO',
@ -4000,7 +3995,6 @@ phutil_register_library_map(array(
'PonderAnswerEditController' => 'PonderController',
'PonderAnswerEditor' => 'PhabricatorApplicationTransactionEditor',
'PonderAnswerHistoryController' => 'PonderController',
'PonderAnswerListView' => 'AphrontView',
'PonderAnswerQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'PonderAnswerSaveController' => 'PonderController',
'PonderAnswerTransaction' => 'PhabricatorApplicationTransaction',
@ -4014,7 +4008,6 @@ phutil_register_library_map(array(
1 => 'PhabricatorMarkupInterface',
),
'PonderCommentEditor' => 'PhabricatorEditor',
'PonderCommentListView' => 'AphrontView',
'PonderCommentMail' => 'PonderMail',
'PonderCommentQuery' => 'PhabricatorQuery',
'PonderController' => 'PhabricatorController',
@ -4035,7 +4028,6 @@ phutil_register_library_map(array(
5 => 'PhabricatorTokenReceiverInterface',
),
'PonderQuestionCommentController' => 'PonderController',
'PonderQuestionDetailView' => 'AphrontView',
'PonderQuestionEditController' => 'PonderController',
'PonderQuestionEditor' => 'PhabricatorApplicationTransactionEditor',
'PonderQuestionHistoryController' => 'PonderController',

View file

@ -60,8 +60,7 @@ final class PhabricatorApplicationPonder extends PhabricatorApplication {
'question/preview/' => 'PonderQuestionPreviewController',
'question/(?P<status>open|close)/(?P<id>[1-9]\d*)/' =>
'PonderQuestionStatusController',
'(?P<kind>question)/vote/' => 'PonderVoteSaveController',
'(?P<kind>answer)/vote/' => 'PonderVoteSaveController'
'vote/' => 'PonderVoteSaveController',
),
);
}

View file

@ -17,6 +17,7 @@ final class PonderQuestionViewController extends PonderController {
->setViewer($user)
->withIDs(array($this->questionID))
->needAnswers(true)
->needViewerVotes(true)
->executeOne();
if (!$question) {
return new Aphront404Response();
@ -149,11 +150,20 @@ final class PonderQuestionViewController extends PonderController {
$view->invokeWillRenderEvent();
$votable = id(new PonderVotableView())
->setPHID($question->getPHID())
->setURI($this->getApplicationURI('vote/'))
->setCount($question->getVoteCount())
->setVote($question->getUserVote());
$view->addTextContent(
PhabricatorMarkupEngine::renderOneObject(
$question,
$question->getMarkupField(),
$viewer));
array(
$votable,
PhabricatorMarkupEngine::renderOneObject(
$question,
$question->getMarkupField(),
$viewer),
));
return $view;
@ -314,16 +324,25 @@ final class PonderQuestionViewController extends PonderController {
$view->invokeWillRenderEvent();
$votable = id(new PonderVotableView())
->setPHID($answer->getPHID())
->setURI($this->getApplicationURI('vote/'))
->setCount($answer->getVoteCount())
->setVote($answer->getUserVote());
$view->addTextContent(
phutil_tag(
'div',
array(
'class' => 'phabricator-remarkup',
),
PhabricatorMarkupEngine::renderOneObject(
$answer,
$answer->getMarkupField(),
$viewer)));
array(
$votable,
phutil_tag(
'div',
array(
'class' => 'phabricator-remarkup',
),
PhabricatorMarkupEngine::renderOneObject(
$answer,
$answer->getMarkupField(),
$viewer)),
));
return $view;
}

View file

@ -2,17 +2,11 @@
final class PonderVoteSaveController extends PonderController {
private $kind;
public function willProcessRequest(array $data) {
$this->kind = $data['kind'];
}
public function processRequest() {
$request = $this->getRequest();
$user = $request->getUser();
$newvote = $request->getInt("vote");
$phid = $request->getStr("phid");
$viewer = $request->getUser();
$phid = $request->getStr('phid');
$newvote = $request->getInt('vote');
if (1 < $newvote || $newvote < -1) {
return new Aphront400Response();
@ -20,28 +14,20 @@ final class PonderVoteSaveController extends PonderController {
$target = null;
if ($this->kind == "question") {
$target = id(new PonderQuestionQuery())
->setViewer($user)
->withPHIDs(array($phid))
->executeOne();
} else if ($this->kind == "answer") {
$target = id(new PonderAnswerQuery())
->setViewer($user)
->withPHIDs(array($phid))
->executeOne();
}
if (!$target) {
$object = id(new PhabricatorObjectQuery())
->setViewer($viewer)
->withPHIDs(array($phid))
->executeOne();
if (!$object) {
return new Aphront404Response();
}
$editor = id(new PonderVoteEditor())
->setVotable($target)
->setActor($user)
->setVotable($object)
->setActor($viewer)
->setVote($newvote)
->saveVote();
return id(new AphrontAjaxResponse())->setContent(".");
return id(new AphrontAjaxResponse())->setContent(array());
}
}

View file

@ -8,6 +8,9 @@ final class PonderAnswerQuery
private $authorPHIDs;
private $questionIDs;
private $needViewerVotes;
public function withIDs(array $ids) {
$this->ids = $ids;
return $this;
@ -28,6 +31,11 @@ final class PonderAnswerQuery
return $this;
}
public function needViewerVotes($need_viewer_votes) {
$this->needViewerVotes = $need_viewer_votes;
return $this;
}
private function buildWhereClause($conn_r) {
$where = array();
@ -78,11 +86,36 @@ final class PonderAnswerQuery
->withIDs(mpull($answers, 'getQuestionID'))
->execute();
foreach ($answers as $answer) {
foreach ($answers as $key => $answer) {
$question = idx($questions, $answer->getQuestionID());
if (!$question) {
unset($answers[$key]);
continue;
}
$answer->attachQuestion($question);
}
if ($this->needViewerVotes) {
$viewer_phid = $this->getViewer()->getPHID();
$etype = PhabricatorEdgeConfig::TYPE_ANSWER_HAS_VOTING_USER;
$edges = id(new PhabricatorEdgeQuery())
->withSourcePHIDs(mpull($answers, 'getPHID'))
->withDestinationPHIDs(array($viewer_phid))
->withEdgeTypes(array($etype))
->needEdgeData(true)
->execute();
foreach ($answers as $answer) {
$user_edge = idx(
$edges[$answer->getPHID()][$etype],
$viewer_phid,
array());
$answer->attachUserVote($viewer_phid, idx($user_edge, 'data', 0));
}
}
return $answers;
}

View file

@ -18,6 +18,7 @@ final class PonderQuestionQuery
const STATUS_CLOSED = 'status-closed';
private $needAnswers;
private $needViewerVotes;
public function withIDs(array $ids) {
$this->ids = $ids;
@ -49,6 +50,11 @@ final class PonderQuestionQuery
return $this;
}
public function needViewerVotes($need_viewer_votes) {
$this->needViewerVotes = $need_viewer_votes;
return $this;
}
public function setOrder($order) {
$this->order = $order;
return $this;
@ -133,10 +139,15 @@ final class PonderQuestionQuery
public function willFilterPage(array $questions) {
if ($this->needAnswers) {
$answers = id(new PonderAnswerQuery())
$aquery = id(new PonderAnswerQuery())
->setViewer($this->getViewer())
->withQuestionIDs(mpull($questions, 'getID'))
->execute();
->withQuestionIDs(mpull($questions, 'getID'));
if ($this->needViewerVotes) {
$aquery->needViewerVotes($this->needViewerVotes);
}
$answers = $aquery->execute();
$answers = mgroup($answers, 'getQuestionID');
foreach ($questions as $question) {
@ -144,6 +155,26 @@ final class PonderQuestionQuery
}
}
if ($this->needViewerVotes) {
$viewer_phid = $this->getViewer()->getPHID();
$etype = PhabricatorEdgeConfig::TYPE_QUESTION_HAS_VOTING_USER;
$edges = id(new PhabricatorEdgeQuery())
->withSourcePHIDs(mpull($questions, 'getPHID'))
->withDestinationPHIDs(array($viewer_phid))
->withEdgeTypes(array($etype))
->needEdgeData(true)
->execute();
foreach ($questions as $question) {
$user_edge = idx(
$edges[$question->getPHID()][$etype],
$viewer_phid,
array());
$question->attachUserVote($viewer_phid, idx($user_edge, 'data', 0));
}
}
return $questions;
}

View file

@ -21,6 +21,8 @@ final class PonderAnswer extends PonderDAO
private $question = self::ATTACHABLE;
private $comments;
private $userVotes = array();
// TODO: Get rid of this method.
public function setQuestion($question) {
return $this->attachQuestion($question);
@ -43,6 +45,11 @@ final class PonderAnswer extends PonderDAO
return $this;
}
public function attachUserVote($user_phid, $vote) {
$this->vote = $vote;
return $this;
}
public function getUserVote() {
return $this->vote;
}

View file

@ -101,6 +101,11 @@ final class PonderQuestion extends PonderDAO
return $this;
}
public function attachUserVote($user_phid, $vote) {
$this->vote = $vote;
return $this;
}
public function getUserVote() {
return $this->vote;
}

View file

@ -1,56 +0,0 @@
<?php
final class PonderAddCommentView extends AphrontView {
private $target;
private $actionURI;
private $questionID;
public function setTarget($target) {
$this->target = $target;
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)
->setNoShading(true)
->setWorkflow(true)
->addHiddenInput('target', $target)
->addHiddenInput('question_id', $questionID)
->appendChild(
id(new AphrontFormTextAreaControl())
->setName('content'))
->appendChild(
id(new AphrontFormSubmitControl())
->setValue($is_serious ?
pht('Submit') :
pht('Editorialize')));
$view = id(new AphrontMoreView())
->setSome('')
->setMore($form->render())
->setExpandText(pht('Add Comment'));
return $view->render();
}
}

View file

@ -1,80 +0,0 @@
<?php
final class PonderAnswerListView extends AphrontView {
private $question;
private $handles;
private $answers;
public function setQuestion($question) {
$this->question = $question;
return $this;
}
public function setHandles(array $handles) {
assert_instances_of($handles, 'PhabricatorObjectHandle');
$this->handles = $handles;
return $this;
}
public function setAnswers(array $answers) {
assert_instances_of($answers, 'PonderAnswer');
$this->answers = array();
// group by descreasing score, randomizing
// order within groups
$by_score = mgroup($answers, 'getVoteCount');
$scores = array_keys($by_score);
rsort($scores);
foreach ($scores as $score) {
$group = $by_score[$score];
shuffle($group);
foreach ($group as $cur_answer) {
$this->answers[] = $cur_answer;
}
}
return $this;
}
public function render() {
require_celerity_resource('ponder-post-css');
$question = $this->question;
$user = $this->user;
$handles = $this->handles;
$panel = id(new AphrontPanelView())
->setNoBackground()
->setHeader(pht("Responses"));
foreach ($this->answers as $cur_answer) {
$view = new PonderPostBodyView();
$view
->setQuestion($question)
->setTarget($cur_answer)
->setAction(PonderLiterals::LITERAL_ANSWERED)
->setHandles($handles)
->setUser($user);
$commentview = new PonderCommentListView();
$commentview
->setUser($user)
->setHandles($handles)
->setComments($cur_answer->getComments())
->setTarget($cur_answer->getPHID())
->setQuestionID($question->getID())
->setActionURI(new PhutilURI('/ponder/comment/add/'));
$panel->appendChild($view);
$panel->appendChild($commentview);
$panel->appendChild(
hsprintf('<div style="height: 20px; clear: both"></div>'));
}
return $panel->render();
}
}

View file

@ -1,90 +0,0 @@
<?php
final class PonderCommentListView extends AphrontView {
private $handles;
private $comments;
private $target;
private $actionURI;
private $questionID;
public function setHandles(array $handles) {
assert_instances_of($handles, 'PhabricatorObjectHandle');
$this->handles = $handles;
return $this;
}
public function setComments(array $comments) {
assert_instances_of($comments, 'PonderComment');
$this->comments = $comments;
return $this;
}
public function setQuestionID($id) {
$this->questionID = $id;
return $this;
}
public function setActionURI($uri) {
$this->actionURI = $uri;
return $this;
}
public function setTarget($target) {
$this->target = $target;
return $this;
}
public function render() {
require_celerity_resource('phabricator-remarkup-css');
require_celerity_resource('ponder-comment-table-css');
$user = $this->user;
$handles = $this->handles;
$comments = $this->comments;
$comment_markup = array();
foreach ($comments as $comment) {
$handle = $handles[$comment->getAuthorPHID()];
$body = PhabricatorMarkupEngine::renderOneObject(
$comment,
$comment->getMarkupField(),
$this->user);
$comment_anchor = '';
$comment_markup[] = hsprintf(
'<tr>'.
'<th><a name="comment-%s" /></th>'.
'<td>'.
'<div class="phabricator-remarkup ponder-comment-markup">'.
'%s -%s <span class="ponder-datestamp">%s</span>'.
'</div>'.
'</td>'.
'</tr>',
$comment->getID(),
$body,
$handle->renderLink(),
phabricator_datetime($comment->getDateCreated(), $user));
}
$addview = id(new PonderAddCommentView)
->setTarget($this->target)
->setUser($user)
->setQuestionID($this->questionID)
->setActionURI($this->actionURI);
$comment_markup[] = hsprintf(
'<tr><th>&nbsp;</th><td>%s</td></tr>',
$addview->render());
$comment_markup = phutil_tag(
'table',
array(
'class' => 'ponder-comments',
),
$comment_markup);
return $comment_markup;
}
}

View file

@ -97,24 +97,7 @@ final class PonderPostBodyView extends AphrontView {
),
$content));
$outerview = $xaction_view;
if (!$this->preview) {
$outerview =
id(new PonderVotableView())
->setPHID($target->getPHID())
->setCount($target->getVoteCount())
->setVote($target->getUserVote());
if ($this->target instanceof PonderAnswer) {
$outerview->setURI('/ponder/answer/vote/');
} else {
$outerview->setURI('/ponder/question/vote/');
}
$outerview->appendChild($xaction_view);
}
return $outerview->render();
return $xaction_view;
}
}

View file

@ -1,50 +0,0 @@
<?php
final class PonderQuestionDetailView extends AphrontView {
private $question;
private $handles;
public function setQuestion($question) {
$this->question = $question;
return $this;
}
public function setHandles($handles) {
$this->handles = $handles;
return $this;
}
public function render() {
$question = $this->question;
$handles = $this->handles;
$user = $this->user;
$panel = id(new AphrontPanelView())
->setNoBackground(true);
$contentview = new PonderPostBodyView();
$contentview
->setTarget($question)
->setQuestion($question)
->setUser($user)
->setHandles($handles)
->setAction(PonderLiterals::LITERAL_ASKED);
$commentview = new PonderCommentListView();
$commentview
->setUser($user)
->setHandles($handles)
->setComments($question->getComments())
->setTarget($question->getPHID())
->setQuestionID($question->getID())
->setActionURI(new PhutilURI('/ponder/comment/add/'));
$panel->appendChild($contentview);
$panel->appendChild($commentview);
return $panel->render();
}
}

View file

@ -2,60 +2,42 @@
* @provides ponder-vote-css
*/
.ponder-votable {
float: right;
margin: 4px 0 4px 24px;
}
.ponder-votebox {
border-radius: 4px;
background: #f3f3f3;
border: 1px solid #d7d7d7;
box-shadow: 1px 1px rgba(0, 0, 0, 0.05);
text-align: center;
width: 24px;
}
.ponder-votebox a {
font-size: 20px;
line-height: 20px;
line-height: 24px;
display: block;
text-decoration: none;
color: #a1a5a9;
color: #aaaaaa;
font-weight: normal;
}
.ponder-votebox a:hover {
color: #606060;
}
.ponder-votebox a.ponder-vote-active {
color: #3b5998;
color: {$blue};
}
.ponder-votebox a.ponder-vote-active:hover {
color: #a1bbe5;
.ponder-votebox a:hover {
color: #ffffff;
background: {$blue};
}
.ponder-vote-count {
color: #888888;
color: #333333;
font-size: 14px;
line-height: 14px;
line-height: 20px;
font-weight: bold;
}
.ponder-votebox {
float: left;
width: 32px;
height: 60px;
margin-top: 56px;
margin-left: 10px;
}
.device-phone .ponder-votebox {
margin: 0;
}
.device-phone .ponder-votebox-content {
margin-left: 35px;
}
.ponder-votable .phabricator-transaction-view {
margin: 0;
padding: 0;
}
.ponder-votable .phabricator-transaction-detail {
min-height : 90px;
}

View file

@ -91,6 +91,7 @@
padding: 12px 18px;
background: #fdfdfd;
border-bottom: 1px solid #dbdbdb;
overflow: hidden;
}
.phabricator-property-list-image-content {