Differential D13707 Diff 33126 src/applications/countdown/controller/PhabricatorCountdownViewController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/countdown/controller/PhabricatorCountdownViewController.php
Show First 20 Lines • Show All 52 Lines • ▼ Show 20 Lines | public function handleRequest(AphrontRequest $request) { | ||||
$object_box = id(new PHUIObjectBoxView()) | $object_box = id(new PHUIObjectBoxView()) | ||||
->setHeader($header) | ->setHeader($header) | ||||
->addPropertyList($properties); | ->addPropertyList($properties); | ||||
$timeline = $this->buildTransactionTimeline( | $timeline = $this->buildTransactionTimeline( | ||||
$countdown, | $countdown, | ||||
new PhabricatorCountdownTransactionQuery()); | new PhabricatorCountdownTransactionQuery()); | ||||
$timeline->setShouldTerminate(true); | |||||
$add_comment = $this->buildCommentForm($countdown); | |||||
$content = array( | $content = array( | ||||
$crumbs, | $crumbs, | ||||
$object_box, | $object_box, | ||||
$countdown_view, | $countdown_view, | ||||
$timeline, | $timeline, | ||||
$add_comment, | |||||
); | ); | ||||
return $this->buildApplicationPage( | return $this->buildApplicationPage( | ||||
$content, | $content, | ||||
array( | array( | ||||
'title' => $title, | 'title' => $title, | ||||
'pageObjects' => array($countdown->getPHID()), | |||||
)); | )); | ||||
} | } | ||||
private function buildActionListView(PhabricatorCountdown $countdown) { | private function buildActionListView(PhabricatorCountdown $countdown) { | ||||
$request = $this->getRequest(); | $request = $this->getRequest(); | ||||
$viewer = $request->getUser(); | $viewer = $request->getUser(); | ||||
$id = $countdown->getID(); | $id = $countdown->getID(); | ||||
▲ Show 20 Lines • Show All 54 Lines • ▼ Show 20 Lines | if (strlen($description)) { | ||||
pht('Description'), | pht('Description'), | ||||
PHUIPropertyListView::ICON_SUMMARY); | PHUIPropertyListView::ICON_SUMMARY); | ||||
$view->addTextContent($description); | $view->addTextContent($description); | ||||
} | } | ||||
return $view; | return $view; | ||||
} | } | ||||
private function buildCommentForm(PhabricatorCountdown $countdown) { | |||||
$viewer = $this->getViewer(); | |||||
$is_serious = PhabricatorEnv::getEnvConfig('phabricator.serious-business'); | |||||
$add_comment_header = $is_serious | |||||
? pht('Add Comment') | |||||
: pht('Last Words'); | |||||
$draft = PhabricatorDraft::newFromUserAndKey( | |||||
$viewer, $countdown->getPHID()); | |||||
return id(new PhabricatorApplicationTransactionCommentView()) | |||||
->setUser($viewer) | |||||
->setObjectPHID($countdown->getPHID()) | |||||
->setDraft($draft) | |||||
->setHeaderText($add_comment_header) | |||||
->setAction($this->getApplicationURI('/comment/'.$countdown->getID().'/')) | |||||
->setSubmitButtonName(pht('Add Comment')); | |||||
} | |||||
} | } |