Permalink
Browse files

Add a 404 page, fixes #568

  • Loading branch information...
TheoChevalier authored and pascalchevrel committed Apr 4, 2016
1 parent 0c18b9c commit 3bc1a0a3602dd0ed727058d642aba8c7e2017d46
Showing with 37 additions and 6 deletions.
  1. +9 −2 app/inc/dispatcher.php
  2. +0 −4 app/inc/router.php
  3. +11 −0 app/views/404.php
  4. +2 −0 tests/functional/pages.php
  5. BIN web/img/404.png
  6. +15 −0 web/style/transvision.css
View
@@ -1,8 +1,13 @@
<?php
namespace Transvision;
if ($api_url) {
$page = 'api';
} else {
$page = isset($urls[$url['path']]) ? $urls[$url['path']] : 'notfound';
}
$template = true;
$page = $api_url ? 'api' : $urls[$url['path']];
$extra = null;
$experimental = false;
$show_title = true;
@@ -110,7 +115,9 @@
$page_descr = 'Show potential errors related to missing or mispelled variables in your strings.';
break;
default:
$controller = 'mainsearch';
$view = '404';
$page_title = '404: Page Not Found';
$page_descr = '';
break;
}
View
@@ -47,10 +47,6 @@
// Include all valid urls here
require_once __DIR__ . '/urls.php';
if (! array_key_exists($url['path'], $urls) && ! $api_url) {
return false;
}
// Always redirect to an url ending with slashes
$temp_url = parse_url(str_replace(':', '%3A', $_SERVER['REQUEST_URI']));
if (substr($temp_url['path'], -1) != '/') {
View
@@ -0,0 +1,11 @@
<?php
namespace Transvision;
http_response_code(400);
?>
<div id="pagecontent">
<p>
You can use the menu at the top to browse the available pages. If you think this URL should work and it’s a bug, please <a href="https://github.com/mozfr/transvision/issues/new">open an issue on GitHub</a>.
</p>
<img src="/img/404.png"/>
</div>
@@ -17,6 +17,8 @@
['unchanged/', 200, 'Display a list of strings identical', 'Locale'],
['unlocalized/', 200, 'Display the list of the most common untranslated words', 'Occurrences'],
['variables/', 200, 'Show potential errors related to', 'no errors found'],
['foo/', 400, '404: Page Not Found', 'You can use the menu at the top'],
['123/', 400, '404: Page Not Found', 'You can use the menu at the top'],
];
$obj = new \pchevrel\Verif('Check public pages HTTP responses and content');
View
Binary file not shown.
View
@@ -818,6 +818,21 @@ fieldset {
text-align: right;
}
/* 404 */
#notfound #pagecontent {
text-align: center;
width: 90%;
margin: auto;
}
#notfound #pagecontent img {
max-width: 800px;
max-height: 379px;
width: 100%;
height: 100%;
margin-top: 15px;
}
/* Responsive */
@media only screen and (max-width: 850px) {

0 comments on commit 3bc1a0a

Please sign in to comment.