1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-29 10:12:41 +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:
Chad Little 2014-09-26 17:40:09 -07:00
parent 3ce107fc42
commit f74082aecd
7 changed files with 32 additions and 100 deletions

View file

@ -28,7 +28,6 @@ return array(
'rsrc/css/aphront/pager-view.css' => '2e3539af', 'rsrc/css/aphront/pager-view.css' => '2e3539af',
'rsrc/css/aphront/panel-view.css' => '5846dfa2', 'rsrc/css/aphront/panel-view.css' => '5846dfa2',
'rsrc/css/aphront/phabricator-nav-view.css' => '9283c2df', '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/table-view.css' => 'b22b7216',
'rsrc/css/aphront/tokenizer.css' => '82ce2142', 'rsrc/css/aphront/tokenizer.css' => '82ce2142',
'rsrc/css/aphront/tooltip.css' => '9c90229d', 'rsrc/css/aphront/tooltip.css' => '9c90229d',
@ -506,7 +505,6 @@ return array(
'aphront-multi-column-view-css' => '1b95ab2e', 'aphront-multi-column-view-css' => '1b95ab2e',
'aphront-pager-view-css' => '2e3539af', 'aphront-pager-view-css' => '2e3539af',
'aphront-panel-view-css' => '5846dfa2', 'aphront-panel-view-css' => '5846dfa2',
'aphront-request-failure-view-css' => '7a83dc3a',
'aphront-table-view-css' => 'b22b7216', 'aphront-table-view-css' => 'b22b7216',
'aphront-tokenizer-control-css' => '82ce2142', 'aphront-tokenizer-control-css' => '82ce2142',
'aphront-tooltip-css' => '9c90229d', 'aphront-tooltip-css' => '9c90229d',

View file

@ -79,7 +79,6 @@ phutil_register_library_map(array(
'AphrontRedirectResponseTestCase' => 'aphront/response/__tests__/AphrontRedirectResponseTestCase.php', 'AphrontRedirectResponseTestCase' => 'aphront/response/__tests__/AphrontRedirectResponseTestCase.php',
'AphrontReloadResponse' => 'aphront/response/AphrontReloadResponse.php', 'AphrontReloadResponse' => 'aphront/response/AphrontReloadResponse.php',
'AphrontRequest' => 'aphront/AphrontRequest.php', 'AphrontRequest' => 'aphront/AphrontRequest.php',
'AphrontRequestFailureView' => 'view/page/AphrontRequestFailureView.php',
'AphrontRequestTestCase' => 'aphront/__tests__/AphrontRequestTestCase.php', 'AphrontRequestTestCase' => 'aphront/__tests__/AphrontRequestTestCase.php',
'AphrontResponse' => 'aphront/response/AphrontResponse.php', 'AphrontResponse' => 'aphront/response/AphrontResponse.php',
'AphrontSideNavFilterView' => 'view/layout/AphrontSideNavFilterView.php', 'AphrontSideNavFilterView' => 'view/layout/AphrontSideNavFilterView.php',
@ -2923,7 +2922,6 @@ phutil_register_library_map(array(
'AphrontRedirectResponse' => 'AphrontResponse', 'AphrontRedirectResponse' => 'AphrontResponse',
'AphrontRedirectResponseTestCase' => 'PhabricatorTestCase', 'AphrontRedirectResponseTestCase' => 'PhabricatorTestCase',
'AphrontReloadResponse' => 'AphrontRedirectResponse', 'AphrontReloadResponse' => 'AphrontRedirectResponse',
'AphrontRequestFailureView' => 'AphrontView',
'AphrontRequestTestCase' => 'PhabricatorTestCase', 'AphrontRequestTestCase' => 'PhabricatorTestCase',
'AphrontSideNavFilterView' => 'AphrontView', 'AphrontSideNavFilterView' => 'AphrontView',
'AphrontStackTraceView' => 'AphrontView', 'AphrontStackTraceView' => 'AphrontView',

View file

@ -19,16 +19,23 @@ final class Aphront403Response extends AphrontHTMLResponse {
$forbidden_text = $this->getForbiddenText(); $forbidden_text = $this->getForbiddenText();
if (!$forbidden_text) { if (!$forbidden_text) {
$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(); $request = $this->getRequest();
$view->setTitle('403 Forbidden'); $user = $request->getUser();
$view->setRequest($this->getRequest());
$view->appendChild($failure); $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(); return $view->render();
} }

View file

@ -7,16 +7,22 @@ final class Aphront404Response extends AphrontHTMLResponse {
} }
public function buildResponseString() { public function buildResponseString() {
$failure = id(new AphrontRequestFailureView()) $request = $this->getRequest();
->setHeader(pht('404 Not Found')) $user = $request->getUser();
->appendChild(phutil_tag('p', array(), pht(
'The page you requested was not found.'))); $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()) $view = id(new PhabricatorStandardPageView())
->setTitle('404 Not Found') ->setTitle('404 Not Found')
->setRequest($this->getRequest()) ->setRequest($request)
->setDeviceReady(true) ->setDeviceReady(true)
->appendChild($failure); ->appendChild($dialog);
return $view->render(); return $view->render();
} }

View file

@ -14,16 +14,11 @@ final class PhabricatorDisabledUserController
return new Aphront404Response(); return new Aphront404Response();
} }
$failure_view = new AphrontRequestFailureView(); return id(new AphrontDialogView())
$failure_view->setHeader(pht('Account Disabled')); ->setUser($user)
$failure_view->appendChild(phutil_tag('p', array(), pht( ->setTitle(pht('Account Disabled'))
'Your account has been disabled.'))); ->addCancelButton('/logout/', pht('Okay'))
->appendParagraph(pht('Your account has been disabled.'));
return $this->buildStandardPageResponse(
$failure_view,
array(
'title' => pht('Account Disabled'),
));
} }
} }

View file

@ -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));
}
}

View file

@ -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;
}