mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-26 00:32:42 +01:00
Make 404 page somewhat prettier.
This commit is contained in:
parent
6c37f918b1
commit
406a14ebe5
8 changed files with 107 additions and 5 deletions
|
@ -34,6 +34,15 @@ celerity_register_resource_map(array(
|
|||
),
|
||||
'disk' => '/rsrc/css/aphront/panel-view.css',
|
||||
),
|
||||
'aphront-request-failure-view-css' =>
|
||||
array(
|
||||
'uri' => '/res/d7df3b42/rsrc/css/aphront/request-failure-view.css',
|
||||
'type' => 'css',
|
||||
'requires' =>
|
||||
array(
|
||||
),
|
||||
'disk' => '/rsrc/css/aphront/request-failure-view.css',
|
||||
),
|
||||
'aphront-side-nav-view-css' =>
|
||||
array(
|
||||
'uri' => '/res/0fc0545c/rsrc/css/aphront/side-nav-view.css',
|
||||
|
|
|
@ -45,6 +45,7 @@ phutil_register_library_map(array(
|
|||
'AphrontRedirectException' => 'aphront/exception/redirect',
|
||||
'AphrontRedirectResponse' => 'aphront/response/redirect',
|
||||
'AphrontRequest' => 'aphront/request',
|
||||
'AphrontRequestFailureView' => 'view/page/failure',
|
||||
'AphrontResponse' => 'aphront/response/base',
|
||||
'AphrontSideNavView' => 'view/layout/sidenav',
|
||||
'AphrontTableView' => 'view/control/table',
|
||||
|
@ -210,6 +211,7 @@ phutil_register_library_map(array(
|
|||
'AphrontQueryRecoverableException' => 'AphrontQueryException',
|
||||
'AphrontRedirectException' => 'AphrontException',
|
||||
'AphrontRedirectResponse' => 'AphrontResponse',
|
||||
'AphrontRequestFailureView' => 'AphrontView',
|
||||
'AphrontSideNavView' => 'AphrontView',
|
||||
'AphrontTableView' => 'AphrontView',
|
||||
'AphrontWebpageResponse' => 'AphrontResponse',
|
||||
|
|
|
@ -151,9 +151,15 @@ class AphrontDefaultApplicationConfiguration
|
|||
return $response;
|
||||
}
|
||||
} else if ($response instanceof Aphront404Response) {
|
||||
|
||||
$failure = new AphrontRequestFailureView();
|
||||
$failure->setHeader('404 Not Found');
|
||||
$failure->appendChild(
|
||||
'<p>The page you requested was not found.</p>');
|
||||
|
||||
$view = new PhabricatorStandardPageView();
|
||||
$view->appendChild('404 Not Found');
|
||||
$view->setTitle('404 Not Found');
|
||||
$view->appendChild($failure);
|
||||
|
||||
$response = new AphrontWebpageResponse();
|
||||
$response->setContent($view->render());
|
||||
|
|
|
@ -10,6 +10,7 @@ phutil_require_module('phabricator', 'aphront/applicationconfiguration');
|
|||
phutil_require_module('phabricator', 'aphront/request');
|
||||
phutil_require_module('phabricator', 'aphront/response/webpage');
|
||||
phutil_require_module('phabricator', 'applications/base/controller/404');
|
||||
phutil_require_module('phabricator', 'view/page/failure');
|
||||
phutil_require_module('phabricator', 'view/page/standard');
|
||||
|
||||
phutil_require_module('phutil', 'markup');
|
||||
|
|
43
src/view/page/failure/AphrontRequestFailureView.php
Executable file
43
src/view/page/failure/AphrontRequestFailureView.php
Executable file
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright 2011 Facebook, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
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');
|
||||
|
||||
return
|
||||
'<div class="aphront-request-failure-view">'.
|
||||
'<div class="aphront-request-failure-head">'.
|
||||
'<h1>'.phutil_escape_html($this->header).'</h1>'.
|
||||
'</div>'.
|
||||
'<div class="aphront-request-failure-body">'.
|
||||
$this->renderChildren().
|
||||
'</div>'.
|
||||
'</div>';
|
||||
}
|
||||
|
||||
}
|
14
src/view/page/failure/__init__.php
Normal file
14
src/view/page/failure/__init__.php
Normal file
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is automatically generated. Lint this module to rebuild it.
|
||||
* @generated
|
||||
*/
|
||||
|
||||
|
||||
|
||||
phutil_require_module('phabricator', 'view/base');
|
||||
|
||||
phutil_require_module('phutil', 'markup');
|
||||
|
||||
|
||||
phutil_require_source('AphrontRequestFailureView.php');
|
27
webroot/rsrc/css/aphront/request-failure-view.css
Normal file
27
webroot/rsrc/css/aphront/request-failure-view.css
Normal file
|
@ -0,0 +1,27 @@
|
|||
/**
|
||||
* @provides aphront-request-failure-view-css
|
||||
*/
|
||||
|
||||
.aphront-request-failure-view {
|
||||
margin: 2em auto;
|
||||
background: #eff2f7;
|
||||
width: 600px;
|
||||
}
|
||||
|
||||
.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;
|
||||
}
|
||||
|
||||
.aphront-request-failure-view .aphront-request-failure-body p {
|
||||
margin: .5em 0 1.25em;
|
||||
}
|
Loading…
Reference in a new issue