mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-23 14:00:56 +01:00
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
This commit is contained in:
parent
d63789e4b2
commit
e7fbfb1eac
4 changed files with 45 additions and 39 deletions
|
@ -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(
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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(''));
|
||||
|
|
|
@ -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(
|
||||
|
|
Loading…
Reference in a new issue