mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-26 00:32:42 +01:00
Update AphrontRequestFailure to common display libs
Summary: Moves to PHUIObjectBox, removes old CSS Test Plan: Pull up 404 page. Reviewers: epriestley Reviewed By: epriestley Subscribers: epriestley, Korvin Differential Revision: https://secure.phabricator.com/D10578
This commit is contained in:
parent
3ce107fc42
commit
f74082aecd
7 changed files with 32 additions and 100 deletions
|
@ -28,7 +28,6 @@ return array(
|
|||
'rsrc/css/aphront/pager-view.css' => '2e3539af',
|
||||
'rsrc/css/aphront/panel-view.css' => '5846dfa2',
|
||||
'rsrc/css/aphront/phabricator-nav-view.css' => '9283c2df',
|
||||
'rsrc/css/aphront/request-failure-view.css' => '7a83dc3a',
|
||||
'rsrc/css/aphront/table-view.css' => 'b22b7216',
|
||||
'rsrc/css/aphront/tokenizer.css' => '82ce2142',
|
||||
'rsrc/css/aphront/tooltip.css' => '9c90229d',
|
||||
|
@ -506,7 +505,6 @@ return array(
|
|||
'aphront-multi-column-view-css' => '1b95ab2e',
|
||||
'aphront-pager-view-css' => '2e3539af',
|
||||
'aphront-panel-view-css' => '5846dfa2',
|
||||
'aphront-request-failure-view-css' => '7a83dc3a',
|
||||
'aphront-table-view-css' => 'b22b7216',
|
||||
'aphront-tokenizer-control-css' => '82ce2142',
|
||||
'aphront-tooltip-css' => '9c90229d',
|
||||
|
|
|
@ -79,7 +79,6 @@ phutil_register_library_map(array(
|
|||
'AphrontRedirectResponseTestCase' => 'aphront/response/__tests__/AphrontRedirectResponseTestCase.php',
|
||||
'AphrontReloadResponse' => 'aphront/response/AphrontReloadResponse.php',
|
||||
'AphrontRequest' => 'aphront/AphrontRequest.php',
|
||||
'AphrontRequestFailureView' => 'view/page/AphrontRequestFailureView.php',
|
||||
'AphrontRequestTestCase' => 'aphront/__tests__/AphrontRequestTestCase.php',
|
||||
'AphrontResponse' => 'aphront/response/AphrontResponse.php',
|
||||
'AphrontSideNavFilterView' => 'view/layout/AphrontSideNavFilterView.php',
|
||||
|
@ -2923,7 +2922,6 @@ phutil_register_library_map(array(
|
|||
'AphrontRedirectResponse' => 'AphrontResponse',
|
||||
'AphrontRedirectResponseTestCase' => 'PhabricatorTestCase',
|
||||
'AphrontReloadResponse' => 'AphrontRedirectResponse',
|
||||
'AphrontRequestFailureView' => 'AphrontView',
|
||||
'AphrontRequestTestCase' => 'PhabricatorTestCase',
|
||||
'AphrontSideNavFilterView' => 'AphrontView',
|
||||
'AphrontStackTraceView' => 'AphrontView',
|
||||
|
|
|
@ -19,16 +19,23 @@ final class Aphront403Response extends AphrontHTMLResponse {
|
|||
$forbidden_text = $this->getForbiddenText();
|
||||
if (!$forbidden_text) {
|
||||
$forbidden_text =
|
||||
'You do not have privileges to access the requested page.';
|
||||
pht('You do not have privileges to access the requested page.');
|
||||
}
|
||||
$failure = new AphrontRequestFailureView();
|
||||
$failure->setHeader('403 Forbidden');
|
||||
$failure->appendChild(phutil_tag('p', array(), $forbidden_text));
|
||||
|
||||
$view = new PhabricatorStandardPageView();
|
||||
$view->setTitle('403 Forbidden');
|
||||
$view->setRequest($this->getRequest());
|
||||
$view->appendChild($failure);
|
||||
$request = $this->getRequest();
|
||||
$user = $request->getUser();
|
||||
|
||||
$dialog = id(new AphrontDialogView())
|
||||
->setUser($user)
|
||||
->setTitle(pht('403 Forbidden'))
|
||||
->addCancelButton('/', pht('Peace Out'))
|
||||
->appendParagraph($forbidden_text);
|
||||
|
||||
$view = id(new PhabricatorStandardPageView())
|
||||
->setTitle(pht('403 Forbidden'))
|
||||
->setRequest($request)
|
||||
->setDeviceReady(true)
|
||||
->appendChild($dialog);
|
||||
|
||||
return $view->render();
|
||||
}
|
||||
|
|
|
@ -7,16 +7,22 @@ final class Aphront404Response extends AphrontHTMLResponse {
|
|||
}
|
||||
|
||||
public function buildResponseString() {
|
||||
$failure = id(new AphrontRequestFailureView())
|
||||
->setHeader(pht('404 Not Found'))
|
||||
->appendChild(phutil_tag('p', array(), pht(
|
||||
'The page you requested was not found.')));
|
||||
$request = $this->getRequest();
|
||||
$user = $request->getUser();
|
||||
|
||||
$dialog = id(new AphrontDialogView())
|
||||
->setUser($user)
|
||||
->setTitle(pht('404 Not Found'))
|
||||
->addCancelButton('/', pht('Focus'))
|
||||
->appendParagraph(pht(
|
||||
'Do not dwell in the past, do not dream of the future, '.
|
||||
'concentrate the mind on the present moment.'));
|
||||
|
||||
$view = id(new PhabricatorStandardPageView())
|
||||
->setTitle('404 Not Found')
|
||||
->setRequest($this->getRequest())
|
||||
->setRequest($request)
|
||||
->setDeviceReady(true)
|
||||
->appendChild($failure);
|
||||
->appendChild($dialog);
|
||||
|
||||
return $view->render();
|
||||
}
|
||||
|
|
|
@ -14,16 +14,11 @@ final class PhabricatorDisabledUserController
|
|||
return new Aphront404Response();
|
||||
}
|
||||
|
||||
$failure_view = new AphrontRequestFailureView();
|
||||
$failure_view->setHeader(pht('Account Disabled'));
|
||||
$failure_view->appendChild(phutil_tag('p', array(), pht(
|
||||
'Your account has been disabled.')));
|
||||
|
||||
return $this->buildStandardPageResponse(
|
||||
$failure_view,
|
||||
array(
|
||||
'title' => pht('Account Disabled'),
|
||||
));
|
||||
return id(new AphrontDialogView())
|
||||
->setUser($user)
|
||||
->setTitle(pht('Account Disabled'))
|
||||
->addCancelButton('/logout/', pht('Okay'))
|
||||
->appendParagraph(pht('Your account has been disabled.'));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,27 +0,0 @@
|
|||
<?php
|
||||
|
||||
final class AphrontRequestFailureView extends AphrontView {
|
||||
|
||||
private $header;
|
||||
|
||||
public function setHeader($header) {
|
||||
$this->header = $header;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
final public function render() {
|
||||
require_celerity_resource('aphront-request-failure-view-css');
|
||||
|
||||
$head = phutil_tag_div(
|
||||
'aphront-request-failure-head',
|
||||
phutil_tag('h1', array(), $this->header));
|
||||
|
||||
$body = phutil_tag_div(
|
||||
'aphront-request-failure-body',
|
||||
$this->renderChildren());
|
||||
|
||||
return phutil_tag_div('aphront-request-failure-view', array($head, $body));
|
||||
}
|
||||
|
||||
}
|
|
@ -1,45 +0,0 @@
|
|||
/**
|
||||
* @provides aphront-request-failure-view-css
|
||||
*/
|
||||
|
||||
.aphront-request-failure-view {
|
||||
margin: 16px auto;
|
||||
background: #eff2f7;
|
||||
width: 600px;
|
||||
}
|
||||
|
||||
.device .aphront-request-failure-view {
|
||||
width: 90%;
|
||||
}
|
||||
|
||||
.aphront-request-failure-view .aphront-request-failure-head {
|
||||
padding: 1em 2em;
|
||||
border-bottom: 1px solid #afb2b7;
|
||||
background: #dfe2e7;
|
||||
}
|
||||
|
||||
.aphront-request-failure-view .aphront-request-failure-head h1 {
|
||||
font-size: 24px;
|
||||
}
|
||||
|
||||
.aphront-request-failure-view .aphront-request-failure-body {
|
||||
padding: 1em 2em 1.5em;
|
||||
}
|
||||
|
||||
.aphront-request-failure-view .aphront-request-failure-body p {
|
||||
margin: .5em 0;
|
||||
}
|
||||
|
||||
.aphront-failure-continue {
|
||||
margin-top: 1.5em;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.aphront-failure-continue a.button {
|
||||
margin-left: 1em;
|
||||
}
|
||||
|
||||
.aphront-request-failure-view ul {
|
||||
list-style: disc;
|
||||
margin-left: 3em;
|
||||
}
|
Loading…
Reference in a new issue