Add previews to ApplicationTransaction
Summary:
Implements previews for Macros and Pholio.
(Design is nonfinal -- kind of split the difference between `diff_full_view.png`, laziness, and space concerns. Next couple diffs will add more stuff here.)
Test Plan: {F28055}
Reviewers: btrahan, chad
Reviewed By: btrahan
CC: aran, vrana
Maniphest Tasks: T2104
Differential Revision: https://secure.phabricator.com/D4246
This commit is contained in:
@@ -22,10 +22,11 @@ final class PhabricatorMacroCommentController
|
||||
return new Aphront404Response();
|
||||
}
|
||||
|
||||
$is_preview = $request->isPreviewRequest();
|
||||
|
||||
$view_uri = $this->getApplicationURI('/view/'.$macro->getID().'/');
|
||||
|
||||
$xactions = array();
|
||||
|
||||
$xactions[] = id(new PhabricatorMacroTransaction())
|
||||
->setTransactionType(PhabricatorTransactions::TYPE_COMMENT)
|
||||
->attachComment(
|
||||
@@ -40,7 +41,8 @@ final class PhabricatorMacroCommentController
|
||||
PhabricatorContentSource::SOURCE_WEB,
|
||||
array(
|
||||
'ip' => $request->getRemoteAddr(),
|
||||
)));
|
||||
)))
|
||||
->setIsPreview($is_preview);
|
||||
|
||||
try {
|
||||
$xactions = $editor->applyTransactions($macro, $xactions);
|
||||
@@ -54,6 +56,7 @@ final class PhabricatorMacroCommentController
|
||||
return id(new PhabricatorApplicationTransactionResponse())
|
||||
->setViewer($user)
|
||||
->setTransactions($xactions)
|
||||
->setIsPreview($is_preview)
|
||||
->setAnchorOffset($request->getStr('anchor'));
|
||||
} else {
|
||||
return id(new AphrontRedirectResponse())
|
||||
|
||||
@@ -79,23 +79,14 @@ final class PhabricatorMacroViewController
|
||||
? pht('Add Comment')
|
||||
: pht('Grovel in Awe'));
|
||||
|
||||
$add_comment_form = id(new AphrontFormView())
|
||||
->setWorkflow(true)
|
||||
->setFlexible(true)
|
||||
->addSigil('transaction-append')
|
||||
->setAction($this->getApplicationURI('/comment/'.$macro->getID().'/'))
|
||||
$submit_button_name = $is_serious
|
||||
? pht('Add Comment')
|
||||
: pht('Lavish Praise');
|
||||
|
||||
$add_comment_form = id(new PhabricatorApplicationTransactionCommentView())
|
||||
->setUser($user)
|
||||
->appendChild(
|
||||
id(new PhabricatorRemarkupControl())
|
||||
->setUser($user)
|
||||
->setLabel('Comment')
|
||||
->setName('comment'))
|
||||
->appendChild(
|
||||
id(new AphrontFormSubmitControl())
|
||||
->setValue(
|
||||
$is_serious
|
||||
? pht('Add Comment')
|
||||
: pht('Lavish Praise')));
|
||||
->setAction($this->getApplicationURI('/comment/'.$macro->getID().'/'))
|
||||
->setSubmitButtonName($submit_button_name);
|
||||
|
||||
return $this->buildApplicationPage(
|
||||
array(
|
||||
|
||||
Reference in New Issue
Block a user