Changeset View
Changeset View
Standalone View
Standalone View
src/applications/paste/controller/PhabricatorPasteViewController.php
Show First 20 Lines • Show All 60 Lines • ▼ Show 20 Lines | public function handleRequest(AphrontRequest $request) { | ||||
require_celerity_resource('paste-css'); | require_celerity_resource('paste-css'); | ||||
$source_code = phutil_tag( | $source_code = phutil_tag( | ||||
'div', | 'div', | ||||
array( | array( | ||||
'class' => 'container-of-paste', | 'class' => 'container-of-paste', | ||||
), | ), | ||||
$source_code); | $source_code); | ||||
$crumbs = $this->buildApplicationCrumbs($this->buildSideNavView()) | $crumbs = $this->buildApplicationCrumbs() | ||||
->addTextCrumb('P'.$paste->getID(), '/P'.$paste->getID()); | ->addTextCrumb('P'.$paste->getID(), '/P'.$paste->getID()); | ||||
$timeline = $this->buildTransactionTimeline( | $timeline = $this->buildTransactionTimeline( | ||||
$paste, | $paste, | ||||
new PhabricatorPasteTransactionQuery()); | new PhabricatorPasteTransactionQuery()); | ||||
$is_serious = PhabricatorEnv::getEnvConfig('phabricator.serious-business'); | $is_serious = PhabricatorEnv::getEnvConfig('phabricator.serious-business'); | ||||
$add_comment_header = $is_serious | $add_comment_header = $is_serious | ||||
? pht('Add Comment') | ? pht('Add Comment') | ||||
: pht('Eat Paste'); | : pht('Eat Paste'); | ||||
$draft = PhabricatorDraft::newFromUserAndKey($viewer, $paste->getPHID()); | $draft = PhabricatorDraft::newFromUserAndKey($viewer, $paste->getPHID()); | ||||
$add_comment_form = id(new PhabricatorApplicationTransactionCommentView()) | $add_comment_form = id(new PhabricatorApplicationTransactionCommentView()) | ||||
->setUser($viewer) | ->setUser($viewer) | ||||
->setObjectPHID($paste->getPHID()) | ->setObjectPHID($paste->getPHID()) | ||||
->setDraft($draft) | ->setDraft($draft) | ||||
->setHeaderText($add_comment_header) | ->setHeaderText($add_comment_header) | ||||
->setAction($this->getApplicationURI('/comment/'.$paste->getID().'/')) | ->setAction($this->getApplicationURI('/comment/'.$paste->getID().'/')) | ||||
->setSubmitButtonName(pht('Add Comment')); | ->setSubmitButtonName(pht('Add Comment')); | ||||
return $this->buildApplicationPage( | return $this->newPage() | ||||
->setTitle($paste->getFullName()) | |||||
->setCrumbs($crumbs) | |||||
->setPageObjectPHIDs( | |||||
array( | |||||
$paste->getPHID(), | |||||
)) | |||||
->appendChild( | |||||
array( | array( | ||||
$crumbs, | |||||
$object_box, | $object_box, | ||||
$source_code, | $source_code, | ||||
$timeline, | $timeline, | ||||
$add_comment_form, | $add_comment_form, | ||||
), | |||||
array( | |||||
'title' => $paste->getFullName(), | |||||
'pageObjects' => array($paste->getPHID()), | |||||
)); | )); | ||||
} | } | ||||
private function buildHeaderView(PhabricatorPaste $paste) { | private function buildHeaderView(PhabricatorPaste $paste) { | ||||
$title = (nonempty($paste->getTitle())) ? | $title = (nonempty($paste->getTitle())) ? | ||||
$paste->getTitle() : pht('(An Untitled Masterwork)'); | $paste->getTitle() : pht('(An Untitled Masterwork)'); | ||||
if ($paste->isArchived()) { | if ($paste->isArchived()) { | ||||
$header_icon = 'fa-ban'; | $header_icon = 'fa-ban'; | ||||
▲ Show 20 Lines • Show All 94 Lines • Show Last 20 Lines |