Use action list and property list elements in Ponder

Summary: This is sort of silly as-is, but automatically exposes flagging and will give subscribe/unsubscribe and "Subscribers" a place to plug into shortly. For context, see D3637 and T1808.

Test Plan: {F20550}

Reviewers: pieter, btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T1808

Differential Revision: https://secure.phabricator.com/D3641
This commit is contained in:
epriestley
2012-10-05 13:12:31 -07:00
parent a754fdfca3
commit 7c0f0807da
3 changed files with 41 additions and 12 deletions

View File

@@ -52,6 +52,7 @@ final class PonderQuestionViewController extends PonderController {
}
$handles = $this->loadViewerHandles($object_phids);
$this->loadHandles($object_phids);
$detail_panel = new PonderQuestionDetailView();
$detail_panel
@@ -72,9 +73,19 @@ final class PonderQuestionViewController extends PonderController {
->setUser($user)
->setActionURI("/ponder/answer/add/");
$header = id(new PhabricatorHeaderView())
->setObjectName('Q'.$question->getID())
->setHeader($question->getTitle());
$actions = $this->buildActionListView($question);
$properties = $this->buildPropertyListView($question);
$nav = $this->buildSideNavView($question);
$nav->appendChild(
array(
$header,
$actions,
$properties,
$detail_panel,
$responses_panel,
$answer_add_panel
@@ -89,4 +100,29 @@ final class PonderQuestionViewController extends PonderController {
'title' => 'Q'.$question->getID().' '.$question->getTitle()
));
}
private function buildActionListView(PonderQuestion $question) {
$viewer = $this->getRequest()->getUser();
$view = new PhabricatorActionListView();
$view->setUser($viewer);
$view->setObject($question);
return $view;
}
private function buildPropertyListView(PonderQuestion $question) {
$viewer = $this->getRequest()->getUser();
$view = new PhabricatorPropertyListView();
$view->addProperty(
pht('Author'),
$this->getHandle($question->getAuthorPHID())->renderLink());
$view->addProperty(
pht('Created'),
phabricator_datetime($question->getDateCreated(), $viewer));
return $view;
}
}