diff --git a/src/applications/differential/view/DifferentialChangesetListView.php b/src/applications/differential/view/DifferentialChangesetListView.php index 2398863a5c..6172c36f13 100644 --- a/src/applications/differential/view/DifferentialChangesetListView.php +++ b/src/applications/differential/view/DifferentialChangesetListView.php @@ -194,10 +194,14 @@ final class DifferentialChangesetListView extends AphrontView { )); } + $header = null; + if ($this->getTitle() !== null) { + $header = id(new PHUIHeaderView()) + ->setHeader($this->getTitle()); + } + return array( - id(new PHUIHeaderView()) - ->setHeader($this->getTitle()) - ->render(), + $header, phutil_tag( 'div', array( diff --git a/src/applications/diffusion/controller/DiffusionBrowseController.php b/src/applications/diffusion/controller/DiffusionBrowseController.php index 92ad12efad..48313014c0 100644 --- a/src/applications/diffusion/controller/DiffusionBrowseController.php +++ b/src/applications/diffusion/controller/DiffusionBrowseController.php @@ -65,7 +65,7 @@ abstract class DiffusionBrowseController extends DiffusionController { $header = id(new PHUIHeaderView()) ->setUser($viewer) - ->setHeader($this->renderPathLinks($drequest)) + ->setHeader($this->renderPathLinks($drequest, 'browse')) ->setPolicyObject($drequest->getRepository()); return $header; diff --git a/src/applications/diffusion/controller/DiffusionChangeController.php b/src/applications/diffusion/controller/DiffusionChangeController.php index e6def447b0..ee803f1da2 100644 --- a/src/applications/diffusion/controller/DiffusionChangeController.php +++ b/src/applications/diffusion/controller/DiffusionChangeController.php @@ -2,8 +2,13 @@ final class DiffusionChangeController extends DiffusionController { + public function shouldAllowPublic() { + return true; + } + public function processRequest() { $drequest = $this->diffusionRequest; + $viewer = $this->getRequest()->getUser(); $content = array(); @@ -11,7 +16,8 @@ final class DiffusionChangeController extends DiffusionController { 'diffusion.diffquery', array( 'commit' => $drequest->getCommit(), - 'path' => $drequest->getPath())); + 'path' => $drequest->getPath(), + )); $drequest->setCommit($data['effectiveCommit']); $raw_changes = ArcanistDiffChange::newFromConduit($data['changes']); $diff = DifferentialDiff::newFromRawChanges($raw_changes); @@ -31,7 +37,6 @@ final class DiffusionChangeController extends DiffusionController { ); $changeset_view = new DifferentialChangesetListView(); - $changeset_view->setTitle(DiffusionView::nameCommit($repository, $commit)); $changeset_view->setChangesets($changesets); $changeset_view->setVisibleChangesets($changesets); $changeset_view->setRenderingReferences( @@ -45,13 +50,13 @@ final class DiffusionChangeController extends DiffusionController { 'view' => 'raw', ), ); + $right_uri = $drequest->generateURI($raw_params); $raw_params['params']['before'] = $drequest->getRawCommit(); $left_uri = $drequest->generateURI($raw_params); $changeset_view->setRawFileURIs($left_uri, $right_uri); - $changeset_view->setRenderURI( - '/diffusion/'.$callsign.'/diff/'); + $changeset_view->setRenderURI('/diffusion/'.$callsign.'/diff/'); $changeset_view->setWhitespace( DifferentialChangesetParser::WHITESPACE_SHOW_ALL); $changeset_view->setUser($this->getRequest()->getUser()); @@ -61,22 +66,94 @@ final class DiffusionChangeController extends DiffusionController { require_celerity_resource('differential-core-view-css'); $content[] = $changeset_view->render(); - $nav = $this->buildSideNav('change', true); - $nav->appendChild($content); $crumbs = $this->buildCrumbs( array( 'branch' => true, 'path' => true, 'view' => 'change', )); - $nav->setCrumbs($crumbs); + + $links = $this->renderPathLinks($drequest); + + $header = id(new PHUIHeaderView()) + ->setHeader($links) + ->setUser($viewer) + ->setPolicyObject($drequest->getRepository()); + $actions = $this->buildActionView($drequest); + $properties = $this->buildPropertyView($drequest); return $this->buildApplicationPage( - $nav, + array( + $crumbs, + $header, + $actions, + $properties, + $content, + ), array( 'title' => pht('Change'), - 'device' => true, )); } + private function buildActionView(DiffusionRequest $drequest) { + $viewer = $this->getRequest()->getUser(); + + $view = id(new PhabricatorActionListView()) + ->setUser($viewer); + + $history_uri = $drequest->generateURI( + array( + 'action' => 'history', + )); + + $browse_uri = $drequest->generateURI( + array( + 'action' => 'browse', + )); + + $view->addAction( + id(new PhabricatorActionView()) + ->setName(pht('View History')) + ->setHref($history_uri) + ->setIcon('history')); + + $history_uri = $drequest->generateURI( + array( + 'action' => 'browse', + )); + + $view->addAction( + id(new PhabricatorActionView()) + ->setName(pht('Browse Content')) + ->setHref($browse_uri) + ->setIcon('file')); + + return $view; + } + + protected function buildPropertyView(DiffusionRequest $drequest) { + $viewer = $this->getRequest()->getUser(); + + $view = id(new PhabricatorPropertyListView()) + ->setUser($viewer); + + $stable_commit = $drequest->getStableCommitName(); + $callsign = $drequest->getRepository()->getCallsign(); + + $view->addProperty( + pht('Commit'), + phutil_tag( + 'a', + array( + 'href' => $drequest->generateURI( + array( + 'action' => 'commit', + 'commit' => $stable_commit, + )), + ), + $drequest->getRepository()->formatCommitName($stable_commit))); + + return $view; + } + } diff --git a/src/applications/diffusion/controller/DiffusionController.php b/src/applications/diffusion/controller/DiffusionController.php index 34fbe4ca43..b45c4b010d 100644 --- a/src/applications/diffusion/controller/DiffusionController.php +++ b/src/applications/diffusion/controller/DiffusionController.php @@ -122,7 +122,12 @@ abstract class DiffusionController extends PhabricatorController { $crumb_list[] = $crumb; return $crumb_list; } - $crumb->setHref("/diffusion/{$callsign}/"); + $crumb->setHref( + $drequest->generateURI( + array( + 'action' => 'branch', + 'path' => '/', + ))); $crumb_list[] = $crumb; $raw_commit = $drequest->getRawCommit(); @@ -187,9 +192,7 @@ abstract class DiffusionController extends PhabricatorController { break; case 'change': $view_name = pht('Change'); - $crumb_list[] = $crumb->setName( - hsprintf('%s (%s)', $path, $commit_link)); - return $crumb_list; + break; } $uri_params = array( @@ -199,7 +202,7 @@ abstract class DiffusionController extends PhabricatorController { $crumb = id(new PhabricatorCrumbView()) ->setName($view_name); - if ($view == 'browse') { + if ($view == 'browse' || $view == 'change') { $crumb_list[] = $crumb; return $crumb_list; } diff --git a/src/applications/diffusion/controller/DiffusionDiffController.php b/src/applications/diffusion/controller/DiffusionDiffController.php index 2e98ef2175..5f6565bfb4 100644 --- a/src/applications/diffusion/controller/DiffusionDiffController.php +++ b/src/applications/diffusion/controller/DiffusionDiffController.php @@ -2,6 +2,10 @@ final class DiffusionDiffController extends DiffusionController { + public function shouldAllowPublic() { + return true; + } + public function willProcessRequest(array $data) { $data = $data + array( 'dblob' => $this->getRequest()->getStr('ref'), diff --git a/src/applications/diffusion/request/DiffusionRequest.php b/src/applications/diffusion/request/DiffusionRequest.php index f3c17b952a..b346d7af99 100644 --- a/src/applications/diffusion/request/DiffusionRequest.php +++ b/src/applications/diffusion/request/DiffusionRequest.php @@ -371,7 +371,8 @@ abstract class DiffusionRequest { * and formatting to the URI. Parameters are: * * - `action` One of `history`, `browse`, `change`, `lastmodified`, - * `branch` or `revision-ref`. The action specified by the URI. + * `branch`, `tags`, `branches`, or `revision-ref`. The action specified + * by the URI. * - `callsign` Repository callsign. * - `branch` Optional if action is not `branch`, branch name. * - `path` Optional, path to file.