1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-27 09:12:41 +01:00

Use ChangesetListView in Phriction

Summary: Ref T2009. Upgrade this from DetailView to ListView so we get "Highlight As", "View Unified", etc., and respect the unified diff prefernce.

Test Plan: Viewed diffs in Phriction.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T2009

Differential Revision: https://secure.phabricator.com/D12013
This commit is contained in:
epriestley 2015-03-08 06:02:47 -07:00
parent c35cafda2c
commit 100760fb31

View file

@ -72,10 +72,12 @@ final class PhrictionDiffController extends PhrictionController {
$whitespace_mode = DifferentialChangesetParser::WHITESPACE_SHOW_ALL; $whitespace_mode = DifferentialChangesetParser::WHITESPACE_SHOW_ALL;
$parser = new DifferentialChangesetParser(); $parser = id(new DifferentialChangesetParser())
$parser->setUser($user); ->setUser($user)
$parser->setChangeset($changeset); ->setChangeset($changeset)
$parser->setRenderingReference("{$l},{$r}"); ->setRenderingReference("{$l},{$r}");
$parser->readParametersFromRequest($request);
$parser->setWhitespaceMode($whitespace_mode); $parser->setWhitespaceMode($whitespace_mode);
$engine = new PhabricatorMarkupEngine(); $engine = new PhabricatorMarkupEngine();
@ -87,28 +89,25 @@ final class PhrictionDiffController extends PhrictionController {
list($range_s, $range_e, $mask) = list($range_s, $range_e, $mask) =
DifferentialChangesetParser::parseRangeSpecification($spec); DifferentialChangesetParser::parseRangeSpecification($spec);
$output = $parser->render($range_s, $range_e, $mask); $parser->setRange($range_s, $range_e);
$parser->setMask($mask);
if ($request->isAjax()) { if ($request->isAjax()) {
return id(new PhabricatorChangesetResponse()) return id(new PhabricatorChangesetResponse())
->setRenderedChangeset($output); ->setRenderedChangeset($parser->renderChangeset());
} }
$output = id(new DifferentialChangesetDetailView()) $changes = id(new DifferentialChangesetListView())
->setUser($this->getViewer()) ->setUser($this->getViewer())
->setChangeset($changeset) ->setChangesets(array($changeset))
->setRenderingRef("{$l},{$r}") ->setVisibleChangesets(array($changeset))
->setRenderingReferences(array("{$l},{$r}"))
->setRenderURI('/phriction/diff/'.$document->getID().'/') ->setRenderURI('/phriction/diff/'.$document->getID().'/')
->appendChild($output); ->setTitle(pht('Changes'))
->setParser($parser);
require_celerity_resource('differential-changeset-view-css');
require_celerity_resource('syntax-highlighting-css');
require_celerity_resource('phriction-document-css'); require_celerity_resource('phriction-document-css');
Javelin::initBehavior('differential-populate', array(
'changesetViewIDs' => array($output->getID()),
));
$slug = $document->getSlug(); $slug = $document->getSlug();
$revert_l = $this->renderRevertButton($content_l, $current); $revert_l = $this->renderRevertButton($content_l, $current);
@ -198,13 +197,11 @@ final class PhrictionDiffController extends PhrictionController {
'<table class="phriction-revert-table">'. '<table class="phriction-revert-table">'.
'<tr><td>%s</td><td>%s</td>'. '<tr><td>%s</td><td>%s</td>'.
'</table>'. '</table>'.
'%s'.
'</div>', '</div>',
$comparison_table->render(), $comparison_table->render(),
$navigation_table, $navigation_table,
$revert_l, $revert_l,
$revert_r, $revert_r);
$output);
$object_box = id(new PHUIObjectBoxView()) $object_box = id(new PHUIObjectBoxView())
@ -215,6 +212,7 @@ final class PhrictionDiffController extends PhrictionController {
array( array(
$crumbs, $crumbs,
$object_box, $object_box,
$changes,
), ),
array( array(
'title' => pht('Document History'), 'title' => pht('Document History'),