From e7fbfb1eacafa9665c14793708d810bdf0c58552 Mon Sep 17 00:00:00 2001 From: epriestley Date: Mon, 23 Sep 2013 12:53:55 -0700 Subject: [PATCH] Remove some old page rendering code from Diffusion Summary: Get rid of remaining callsites for buildStandardPageResponse() and modernize the UIs. Test Plan: Looked at branches, tags, and commit detail pages. Reviewers: btrahan Reviewed By: btrahan CC: aran Differential Revision: https://secure.phabricator.com/D7062 --- .../DiffusionBranchTableController.php | 18 +++++++---- .../controller/DiffusionCommitController.php | 30 ++++++++++++------- .../controller/DiffusionController.php | 16 ---------- .../controller/DiffusionTagListController.php | 20 ++++++++----- 4 files changed, 45 insertions(+), 39 deletions(-) diff --git a/src/applications/diffusion/controller/DiffusionBranchTableController.php b/src/applications/diffusion/controller/DiffusionBranchTableController.php index 517f6b8787..5211b3ad75 100644 --- a/src/applications/diffusion/controller/DiffusionBranchTableController.php +++ b/src/applications/diffusion/controller/DiffusionBranchTableController.php @@ -2,6 +2,10 @@ final class DiffusionBranchTableController extends DiffusionController { + public function shouldAllowPublic() { + return true; + } + public function processRequest() { $drequest = $this->getDiffusionRequest(); $request = $this->getRequest(); @@ -44,19 +48,21 @@ final class DiffusionBranchTableController extends DiffusionController { ->setDiffusionRequest($drequest); $panel = id(new AphrontPanelView()) - ->setHeader(pht('Branches')) + ->setNoBackground(true) ->appendChild($view) ->appendChild($pager); $content = $panel; } - return $this->buildStandardPageResponse( + $crumbs = $this->buildCrumbs( array( - $this->buildCrumbs( - array( - 'branches' => true, - )), + 'branches' => true, + )); + + return $this->buildApplicationPage( + array( + $crumbs, $content, ), array( diff --git a/src/applications/diffusion/controller/DiffusionCommitController.php b/src/applications/diffusion/controller/DiffusionCommitController.php index e3b40a08a3..65f5cb10ee 100644 --- a/src/applications/diffusion/controller/DiffusionCommitController.php +++ b/src/applications/diffusion/controller/DiffusionCommitController.php @@ -30,6 +30,10 @@ final class DiffusionCommitController extends DiffusionController { $repository = $drequest->getRepository(); $commit = $drequest->loadCommit(); + $crumbs = $this->buildCrumbs(array( + 'commit' => true, + )); + if (!$commit) { $exists = $this->callConduitWithDiffusionRequest( 'diffusion.existsquery', @@ -37,12 +41,22 @@ final class DiffusionCommitController extends DiffusionController { if (!$exists) { return new Aphront404Response(); } - return $this->buildStandardPageResponse( - id(new AphrontErrorView()) - ->setTitle(pht('Error displaying commit.')) - ->appendChild(pht('Failed to load the commit because the commit has '. - 'not been parsed yet.')), - array('title' => pht('Commit Still Parsing'))); + + $error = id(new AphrontErrorView()) + ->setTitle(pht('Commit Still Parsing')) + ->appendChild( + pht( + 'Failed to load the commit because the commit has not been '. + 'parsed yet.')); + + return $this->buildApplicationPage( + array( + $crumbs, + $error, + ), + array( + 'title' => pht('Commit Still Parsing'), + )); } $commit_data = $drequest->loadCommitData(); @@ -346,10 +360,6 @@ final class DiffusionCommitController extends DiffusionController { $repository, $commit->getCommitIdentifier()); - $crumbs = $this->buildCrumbs(array( - 'commit' => true, - )); - $prefs = $user->loadPreferences(); $pref_filetree = PhabricatorUserPreferences::PREFERENCE_DIFF_FILETREE; $pref_collapse = PhabricatorUserPreferences::PREFERENCE_NAV_COLLAPSED; diff --git a/src/applications/diffusion/controller/DiffusionController.php b/src/applications/diffusion/controller/DiffusionController.php index b20f6cda2d..34fbe4ca43 100644 --- a/src/applications/diffusion/controller/DiffusionController.php +++ b/src/applications/diffusion/controller/DiffusionController.php @@ -25,22 +25,6 @@ abstract class DiffusionController extends PhabricatorController { return $this->diffusionRequest; } - public function buildStandardPageResponse($view, array $data) { - - $page = $this->buildStandardPageView(); - - $page->setApplicationName(pht('Diffusion')); - $page->setBaseURI('/diffusion/'); - $page->setTitle(idx($data, 'title')); - $page->setGlyph("\xE2\x89\x88"); - $page->setSearchDefaultScope(PhabricatorSearchScope::SCOPE_COMMITS); - - $page->appendChild($view); - - $response = new AphrontWebpageResponse(); - return $response->setContent($page->render()); - } - final protected function buildSideNav($selected, $has_change_view) { $nav = new AphrontSideNavFilterView(); $nav->setBaseURI(new PhutilURI('')); diff --git a/src/applications/diffusion/controller/DiffusionTagListController.php b/src/applications/diffusion/controller/DiffusionTagListController.php index 5cdd6016c3..bf86b679db 100644 --- a/src/applications/diffusion/controller/DiffusionTagListController.php +++ b/src/applications/diffusion/controller/DiffusionTagListController.php @@ -2,6 +2,10 @@ final class DiffusionTagListController extends DiffusionController { + public function shouldAllowPublic() { + return true; + } + public function processRequest() { $drequest = $this->getDiffusionRequest(); $request = $this->getRequest(); @@ -65,20 +69,22 @@ final class DiffusionTagListController extends DiffusionController { $view->setHandles($handles); $panel = id(new AphrontPanelView()) - ->setHeader(pht('Tags')) + ->setNoBackground(true) ->appendChild($view) ->appendChild($pager); $content = $panel; } - return $this->buildStandardPageResponse( + $crumbs = $this->buildCrumbs( array( - $this->buildCrumbs( - array( - 'tags' => true, - 'commit' => $drequest->getRawCommit(), - )), + 'tags' => true, + 'commit' => $drequest->getRawCommit(), + )); + + return $this->buildApplicationPage( + array( + $crumbs, $content, ), array(