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 {
|
final class DiffusionBranchTableController extends DiffusionController {
|
||||||
|
|
||||||
|
public function shouldAllowPublic() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public function processRequest() {
|
public function processRequest() {
|
||||||
$drequest = $this->getDiffusionRequest();
|
$drequest = $this->getDiffusionRequest();
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
|
@ -44,19 +48,21 @@ final class DiffusionBranchTableController extends DiffusionController {
|
||||||
->setDiffusionRequest($drequest);
|
->setDiffusionRequest($drequest);
|
||||||
|
|
||||||
$panel = id(new AphrontPanelView())
|
$panel = id(new AphrontPanelView())
|
||||||
->setHeader(pht('Branches'))
|
->setNoBackground(true)
|
||||||
->appendChild($view)
|
->appendChild($view)
|
||||||
->appendChild($pager);
|
->appendChild($pager);
|
||||||
|
|
||||||
$content = $panel;
|
$content = $panel;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->buildStandardPageResponse(
|
$crumbs = $this->buildCrumbs(
|
||||||
array(
|
|
||||||
$this->buildCrumbs(
|
|
||||||
array(
|
array(
|
||||||
'branches' => true,
|
'branches' => true,
|
||||||
)),
|
));
|
||||||
|
|
||||||
|
return $this->buildApplicationPage(
|
||||||
|
array(
|
||||||
|
$crumbs,
|
||||||
$content,
|
$content,
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
|
|
|
@ -30,6 +30,10 @@ final class DiffusionCommitController extends DiffusionController {
|
||||||
$repository = $drequest->getRepository();
|
$repository = $drequest->getRepository();
|
||||||
$commit = $drequest->loadCommit();
|
$commit = $drequest->loadCommit();
|
||||||
|
|
||||||
|
$crumbs = $this->buildCrumbs(array(
|
||||||
|
'commit' => true,
|
||||||
|
));
|
||||||
|
|
||||||
if (!$commit) {
|
if (!$commit) {
|
||||||
$exists = $this->callConduitWithDiffusionRequest(
|
$exists = $this->callConduitWithDiffusionRequest(
|
||||||
'diffusion.existsquery',
|
'diffusion.existsquery',
|
||||||
|
@ -37,12 +41,22 @@ final class DiffusionCommitController extends DiffusionController {
|
||||||
if (!$exists) {
|
if (!$exists) {
|
||||||
return new Aphront404Response();
|
return new Aphront404Response();
|
||||||
}
|
}
|
||||||
return $this->buildStandardPageResponse(
|
|
||||||
id(new AphrontErrorView())
|
$error = id(new AphrontErrorView())
|
||||||
->setTitle(pht('Error displaying commit.'))
|
->setTitle(pht('Commit Still Parsing'))
|
||||||
->appendChild(pht('Failed to load the commit because the commit has '.
|
->appendChild(
|
||||||
'not been parsed yet.')),
|
pht(
|
||||||
array('title' => pht('Commit Still Parsing')));
|
'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();
|
$commit_data = $drequest->loadCommitData();
|
||||||
|
@ -346,10 +360,6 @@ final class DiffusionCommitController extends DiffusionController {
|
||||||
$repository,
|
$repository,
|
||||||
$commit->getCommitIdentifier());
|
$commit->getCommitIdentifier());
|
||||||
|
|
||||||
$crumbs = $this->buildCrumbs(array(
|
|
||||||
'commit' => true,
|
|
||||||
));
|
|
||||||
|
|
||||||
$prefs = $user->loadPreferences();
|
$prefs = $user->loadPreferences();
|
||||||
$pref_filetree = PhabricatorUserPreferences::PREFERENCE_DIFF_FILETREE;
|
$pref_filetree = PhabricatorUserPreferences::PREFERENCE_DIFF_FILETREE;
|
||||||
$pref_collapse = PhabricatorUserPreferences::PREFERENCE_NAV_COLLAPSED;
|
$pref_collapse = PhabricatorUserPreferences::PREFERENCE_NAV_COLLAPSED;
|
||||||
|
|
|
@ -25,22 +25,6 @@ abstract class DiffusionController extends PhabricatorController {
|
||||||
return $this->diffusionRequest;
|
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) {
|
final protected function buildSideNav($selected, $has_change_view) {
|
||||||
$nav = new AphrontSideNavFilterView();
|
$nav = new AphrontSideNavFilterView();
|
||||||
$nav->setBaseURI(new PhutilURI(''));
|
$nav->setBaseURI(new PhutilURI(''));
|
||||||
|
|
|
@ -2,6 +2,10 @@
|
||||||
|
|
||||||
final class DiffusionTagListController extends DiffusionController {
|
final class DiffusionTagListController extends DiffusionController {
|
||||||
|
|
||||||
|
public function shouldAllowPublic() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public function processRequest() {
|
public function processRequest() {
|
||||||
$drequest = $this->getDiffusionRequest();
|
$drequest = $this->getDiffusionRequest();
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
|
@ -65,20 +69,22 @@ final class DiffusionTagListController extends DiffusionController {
|
||||||
$view->setHandles($handles);
|
$view->setHandles($handles);
|
||||||
|
|
||||||
$panel = id(new AphrontPanelView())
|
$panel = id(new AphrontPanelView())
|
||||||
->setHeader(pht('Tags'))
|
->setNoBackground(true)
|
||||||
->appendChild($view)
|
->appendChild($view)
|
||||||
->appendChild($pager);
|
->appendChild($pager);
|
||||||
|
|
||||||
$content = $panel;
|
$content = $panel;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->buildStandardPageResponse(
|
$crumbs = $this->buildCrumbs(
|
||||||
array(
|
|
||||||
$this->buildCrumbs(
|
|
||||||
array(
|
array(
|
||||||
'tags' => true,
|
'tags' => true,
|
||||||
'commit' => $drequest->getRawCommit(),
|
'commit' => $drequest->getRawCommit(),
|
||||||
)),
|
));
|
||||||
|
|
||||||
|
return $this->buildApplicationPage(
|
||||||
|
array(
|
||||||
|
$crumbs,
|
||||||
$content,
|
$content,
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
|
|
Loading…
Reference in a new issue