From f74082aecd06f2a5df8859cbbcd39254f529d00d Mon Sep 17 00:00:00 2001 From: Chad Little Date: Fri, 26 Sep 2014 17:40:09 -0700 Subject: [PATCH] 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 --- resources/celerity/map.php | 2 - src/__phutil_library_map__.php | 2 - src/aphront/response/Aphront403Response.php | 23 ++++++---- src/aphront/response/Aphront404Response.php | 18 +++++--- .../PhabricatorDisabledUserController.php | 15 +++---- src/view/page/AphrontRequestFailureView.php | 27 ----------- .../rsrc/css/aphront/request-failure-view.css | 45 ------------------- 7 files changed, 32 insertions(+), 100 deletions(-) delete mode 100644 src/view/page/AphrontRequestFailureView.php delete mode 100644 webroot/rsrc/css/aphront/request-failure-view.css diff --git a/resources/celerity/map.php b/resources/celerity/map.php index 67464e67a0..15e4691c7e 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -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', diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 9b5f3ad6ef..0fd51a691a 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -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', diff --git a/src/aphront/response/Aphront403Response.php b/src/aphront/response/Aphront403Response.php index 8866b0ec0b..3f7f6d73ca 100644 --- a/src/aphront/response/Aphront403Response.php +++ b/src/aphront/response/Aphront403Response.php @@ -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(); } diff --git a/src/aphront/response/Aphront404Response.php b/src/aphront/response/Aphront404Response.php index 1dddc7a01f..85dec30555 100644 --- a/src/aphront/response/Aphront404Response.php +++ b/src/aphront/response/Aphront404Response.php @@ -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(); } diff --git a/src/applications/auth/controller/PhabricatorDisabledUserController.php b/src/applications/auth/controller/PhabricatorDisabledUserController.php index 364a9a61ec..842f2daad6 100644 --- a/src/applications/auth/controller/PhabricatorDisabledUserController.php +++ b/src/applications/auth/controller/PhabricatorDisabledUserController.php @@ -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.')); } } diff --git a/src/view/page/AphrontRequestFailureView.php b/src/view/page/AphrontRequestFailureView.php deleted file mode 100644 index 5910b4468f..0000000000 --- a/src/view/page/AphrontRequestFailureView.php +++ /dev/null @@ -1,27 +0,0 @@ -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)); - } - -} diff --git a/webroot/rsrc/css/aphront/request-failure-view.css b/webroot/rsrc/css/aphront/request-failure-view.css deleted file mode 100644 index 7a2cca8063..0000000000 --- a/webroot/rsrc/css/aphront/request-failure-view.css +++ /dev/null @@ -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; -}