mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-26 16:52:41 +01:00
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:
parent
a754fdfca3
commit
7c0f0807da
3 changed files with 41 additions and 12 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,10 +45,7 @@ final class PonderQuestionDetailView extends AphrontView {
|
|||
$user = $this->user;
|
||||
|
||||
$panel = id(new AphrontPanelView())
|
||||
->addClass("ponder-panel")
|
||||
->setHeader(
|
||||
$this->renderObjectLink().' '.
|
||||
phutil_escape_html($question->getTitle()));
|
||||
->addClass("ponder-panel");
|
||||
|
||||
$contentview = new PonderPostBodyView();
|
||||
$contentview
|
||||
|
@ -73,12 +70,4 @@ final class PonderQuestionDetailView extends AphrontView {
|
|||
return $panel->render();
|
||||
}
|
||||
|
||||
private function renderObjectLink() {
|
||||
return phutil_render_tag(
|
||||
'a',
|
||||
array('href' => '/Q' . $this->question->getID()),
|
||||
"Q". phutil_escape_html($this->question->getID())
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -53,6 +53,10 @@ final class PhabricatorActionListView extends AphrontView {
|
|||
|
||||
$actions = $event->getValue('actions');
|
||||
|
||||
if (!$actions) {
|
||||
return null;
|
||||
}
|
||||
|
||||
require_celerity_resource('phabricator-action-list-view-css');
|
||||
return phutil_render_tag(
|
||||
'ul',
|
||||
|
|
Loading…
Reference in a new issue