mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 08:52:39 +01:00
Remove some low-hanging buildStandardPageResponse() methods
Summary: Ref T9690. I wanted to do an example of how to do these but it looks like most of them are trivial (no callsites) and the rest are a little tricky (weird interaction with frames, or in Releeph). Test Plan: - Used `grep` to look for callsites. - Hit all applications locally, everything worked. Reviewers: chad Reviewed By: chad Maniphest Tasks: T9690 Differential Revision: https://secure.phabricator.com/D14385
This commit is contained in:
parent
300c74c49d
commit
1b00ef08a0
8 changed files with 5 additions and 110 deletions
|
@ -2,18 +2,6 @@
|
||||||
|
|
||||||
abstract class PhabricatorAuthController extends PhabricatorController {
|
abstract class PhabricatorAuthController extends PhabricatorController {
|
||||||
|
|
||||||
public function buildStandardPageResponse($view, array $data) {
|
|
||||||
$page = $this->buildStandardPageView();
|
|
||||||
|
|
||||||
$page->setApplicationName(pht('Login'));
|
|
||||||
$page->setBaseURI('/login/');
|
|
||||||
$page->setTitle(idx($data, 'title'));
|
|
||||||
$page->appendChild($view);
|
|
||||||
|
|
||||||
$response = new AphrontWebpageResponse();
|
|
||||||
return $response->setContent($page->render());
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function renderErrorPage($title, array $messages) {
|
protected function renderErrorPage($title, array $messages) {
|
||||||
$view = new PHUIInfoView();
|
$view = new PHUIInfoView();
|
||||||
$view->setTitle($title);
|
$view->setTitle($title);
|
||||||
|
|
|
@ -2,26 +2,6 @@
|
||||||
|
|
||||||
abstract class PhabricatorFeedController extends PhabricatorController {
|
abstract class PhabricatorFeedController extends PhabricatorController {
|
||||||
|
|
||||||
public function buildStandardPageResponse($view, array $data) {
|
|
||||||
$page = $this->buildStandardPageView();
|
|
||||||
|
|
||||||
$page->setApplicationName(pht('Feed'));
|
|
||||||
$page->setBaseURI('/feed/');
|
|
||||||
$page->setTitle(idx($data, 'title'));
|
|
||||||
$page->setGlyph("\xE2\x88\x9E");
|
|
||||||
$page->appendChild($view);
|
|
||||||
|
|
||||||
$response = new AphrontWebpageResponse();
|
|
||||||
|
|
||||||
if (!empty($data['public'])) {
|
|
||||||
$page->setFrameable(true);
|
|
||||||
$page->setShowChrome(false);
|
|
||||||
$response->setFrameable(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $response->setContent($page->render());
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function buildSideNavView() {
|
protected function buildSideNavView() {
|
||||||
$user = $this->getRequest()->getUser();
|
$user = $this->getRequest()->getUser();
|
||||||
|
|
||||||
|
|
|
@ -1,18 +1,3 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
abstract class PhabricatorHelpController extends PhabricatorController {
|
abstract class PhabricatorHelpController extends PhabricatorController {}
|
||||||
|
|
||||||
public function buildStandardPageResponse($view, array $data) {
|
|
||||||
$page = $this->buildStandardPageView();
|
|
||||||
|
|
||||||
$page->setApplicationName(pht('Help'));
|
|
||||||
$page->setBaseURI('/help/');
|
|
||||||
$page->setTitle(idx($data, 'title'));
|
|
||||||
$page->setGlyph('?');
|
|
||||||
$page->appendChild($view);
|
|
||||||
|
|
||||||
$response = new AphrontWebpageResponse();
|
|
||||||
return $response->setContent($page->render());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -2,20 +2,6 @@
|
||||||
|
|
||||||
abstract class HeraldController extends PhabricatorController {
|
abstract class HeraldController extends PhabricatorController {
|
||||||
|
|
||||||
public function buildStandardPageResponse($view, array $data) {
|
|
||||||
$page = $this->buildStandardPageView();
|
|
||||||
|
|
||||||
$page->setApplicationName(pht('Herald'));
|
|
||||||
$page->setBaseURI('/herald/');
|
|
||||||
$page->setTitle(idx($data, 'title'));
|
|
||||||
$page->setGlyph("\xE2\x98\xBF");
|
|
||||||
|
|
||||||
$page->appendChild($view);
|
|
||||||
|
|
||||||
$response = new AphrontWebpageResponse();
|
|
||||||
return $response->setContent($page->render());
|
|
||||||
}
|
|
||||||
|
|
||||||
public function buildApplicationMenu() {
|
public function buildApplicationMenu() {
|
||||||
return $this->buildSideNavView(true)->getMenu();
|
return $this->buildSideNavView(true)->getMenu();
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,19 +2,6 @@
|
||||||
|
|
||||||
abstract class PhabricatorHomeController extends PhabricatorController {
|
abstract class PhabricatorHomeController extends PhabricatorController {
|
||||||
|
|
||||||
public function buildStandardPageResponse($view, array $data) {
|
|
||||||
$page = $this->buildStandardPageView();
|
|
||||||
|
|
||||||
$page->setBaseURI('/');
|
|
||||||
$page->setTitle(idx($data, 'title'));
|
|
||||||
|
|
||||||
$page->setGlyph("\xE2\x9A\x92");
|
|
||||||
$page->appendChild($view);
|
|
||||||
|
|
||||||
$response = new AphrontWebpageResponse();
|
|
||||||
return $response->setContent($page->render());
|
|
||||||
}
|
|
||||||
|
|
||||||
public function buildNav() {
|
public function buildNav() {
|
||||||
$user = $this->getRequest()->getUser();
|
$user = $this->getRequest()->getUser();
|
||||||
|
|
||||||
|
|
|
@ -1,21 +1,4 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
abstract class PhabricatorNotificationController
|
abstract class PhabricatorNotificationController
|
||||||
extends PhabricatorController {
|
extends PhabricatorController {}
|
||||||
|
|
||||||
public function buildStandardPageResponse($view, array $data) {
|
|
||||||
|
|
||||||
$page = $this->buildStandardPageView();
|
|
||||||
|
|
||||||
$page->setApplicationName(pht('Notification'));
|
|
||||||
$page->setBaseURI('/notification/');
|
|
||||||
$page->setTitle(idx($data, 'title'));
|
|
||||||
$page->setGlyph('!');
|
|
||||||
$page->appendChild($view);
|
|
||||||
|
|
||||||
$response = new AphrontWebpageResponse();
|
|
||||||
return $response->setContent($page->render());
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -8,17 +8,4 @@ abstract class PhabricatorSearchBaseController extends PhabricatorController {
|
||||||
const ACTION_BLOCKS = 'blocks';
|
const ACTION_BLOCKS = 'blocks';
|
||||||
const ACTION_EDGE = 'edge';
|
const ACTION_EDGE = 'edge';
|
||||||
|
|
||||||
public function buildStandardPageResponse($view, array $data) {
|
|
||||||
$page = $this->buildStandardPageView();
|
|
||||||
|
|
||||||
$page->setApplicationName('Search');
|
|
||||||
$page->setBaseURI('/search/');
|
|
||||||
$page->setTitle(idx($data, 'title'));
|
|
||||||
$page->setGlyph("\xC2\xBF");
|
|
||||||
$page->appendChild($view);
|
|
||||||
|
|
||||||
$response = new AphrontWebpageResponse();
|
|
||||||
return $response->setContent($page->render());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,10 +85,9 @@ However, it is likely that `Derp` is even more complex, and rather than
|
||||||
containing one class, each directory has several classes. A typical example
|
containing one class, each directory has several classes. A typical example
|
||||||
happens around the CRUD of an object:
|
happens around the CRUD of an object:
|
||||||
|
|
||||||
- **DerpBaseController**: typically extends @{class:PhabricatorController},
|
- **DerpBaseController**: typically extends @{class:PhabricatorController}
|
||||||
implements `buildStandardPageResponse` with the `Derp` application name
|
and contains any controller-specific functionality used throughout the
|
||||||
and other `Derp`-specific meta-data, and contains any controller-specific
|
`Derp` application.
|
||||||
functionality used throughout the `Derp` application.
|
|
||||||
- **DerpDeleteController**: typically extends `DerpBaseController` and
|
- **DerpDeleteController**: typically extends `DerpBaseController` and
|
||||||
presents a confirmation dialogue to the user about deleting a `Derp`.
|
presents a confirmation dialogue to the user about deleting a `Derp`.
|
||||||
- **DerpEditController**: typically extends `DerpBaseController` and
|
- **DerpEditController**: typically extends `DerpBaseController` and
|
||||||
|
|
Loading…
Reference in a new issue