Skip to content

Commit

Permalink
Merge pull request #12555 from EtienneLem/responsive-static-pages
Browse files Browse the repository at this point in the history
Make static error pages responsive
  • Loading branch information
guilleiguaran committed Nov 11, 2013
2 parents eb6dd34 + 7166507 commit 3bd3c96
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 33 deletions.
29 changes: 18 additions & 11 deletions railties/lib/rails/generators/rails/app/templates/public/404.html
Expand Up @@ -2,17 +2,23 @@
<html> <html>
<head> <head>
<title>The page you were looking for doesn't exist (404)</title> <title>The page you were looking for doesn't exist (404)</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
<style> <style>
body { body {
background-color: #EFEFEF; background-color: #EFEFEF;
color: #2E2F30; color: #2E2F30;
text-align: center; text-align: center;
font-family: arial, sans-serif; font-family: arial, sans-serif;
margin: 0;
} }


div.dialog { div.dialog {
width: 25em; width: 95%;
margin: 4em auto 0 auto; max-width: 33em;
margin: 4em auto 0;
}

div.dialog > div {
border: 1px solid #CCC; border: 1px solid #CCC;
border-right-color: #999; border-right-color: #999;
border-left-color: #999; border-left-color: #999;
Expand All @@ -21,7 +27,7 @@
border-top-left-radius: 9px; border-top-left-radius: 9px;
border-top-right-radius: 9px; border-top-right-radius: 9px;
background-color: white; background-color: white;
padding: 7px 4em 0 4em; padding: 7px 12% 0;
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17); box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
} }


Expand All @@ -31,10 +37,9 @@
line-height: 1.5em; line-height: 1.5em;
} }


body > p { div.dialog > p {
width: 33em; margin: 0 0 1em;
margin: 0 auto 1em; padding: 1em;
padding: 1em 0;
background-color: #F7F7F7; background-color: #F7F7F7;
border: 1px solid #CCC; border: 1px solid #CCC;
border-right-color: #999; border-right-color: #999;
Expand All @@ -44,17 +49,19 @@
border-bottom-right-radius: 4px; border-bottom-right-radius: 4px;
border-top-color: #DADADA; border-top-color: #DADADA;
color: #666; color: #666;
box-shadow:0 3px 8px rgba(50, 50, 50, 0.17); box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
} }
</style> </style>
</head> </head>


<body> <body>
<!-- This file lives in public/404.html --> <!-- This file lives in public/404.html -->
<div class="dialog"> <div class="dialog">
<h1>The page you were looking for doesn't exist.</h1> <div>
<p>You may have mistyped the address or the page may have moved.</p> <h1>The page you were looking for doesn't exist.</h1>
<p>You may have mistyped the address or the page may have moved.</p>
</div>
<p>If you are the application owner check the logs for more information.</p>
</div> </div>
<p>If you are the application owner check the logs for more information.</p>
</body> </body>
</html> </html>
29 changes: 18 additions & 11 deletions railties/lib/rails/generators/rails/app/templates/public/422.html
Expand Up @@ -2,17 +2,23 @@
<html> <html>
<head> <head>
<title>The change you wanted was rejected (422)</title> <title>The change you wanted was rejected (422)</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
<style> <style>
body { body {
background-color: #EFEFEF; background-color: #EFEFEF;
color: #2E2F30; color: #2E2F30;
text-align: center; text-align: center;
font-family: arial, sans-serif; font-family: arial, sans-serif;
margin: 0;
} }


div.dialog { div.dialog {
width: 25em; width: 95%;
margin: 4em auto 0 auto; max-width: 33em;
margin: 4em auto 0;
}

div.dialog > div {
border: 1px solid #CCC; border: 1px solid #CCC;
border-right-color: #999; border-right-color: #999;
border-left-color: #999; border-left-color: #999;
Expand All @@ -21,7 +27,7 @@
border-top-left-radius: 9px; border-top-left-radius: 9px;
border-top-right-radius: 9px; border-top-right-radius: 9px;
background-color: white; background-color: white;
padding: 7px 4em 0 4em; padding: 7px 12% 0;
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17); box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
} }


Expand All @@ -31,10 +37,9 @@
line-height: 1.5em; line-height: 1.5em;
} }


body > p { div.dialog > p {
width: 33em; margin: 0 0 1em;
margin: 0 auto 1em; padding: 1em;
padding: 1em 0;
background-color: #F7F7F7; background-color: #F7F7F7;
border: 1px solid #CCC; border: 1px solid #CCC;
border-right-color: #999; border-right-color: #999;
Expand All @@ -44,17 +49,19 @@
border-bottom-right-radius: 4px; border-bottom-right-radius: 4px;
border-top-color: #DADADA; border-top-color: #DADADA;
color: #666; color: #666;
box-shadow:0 3px 8px rgba(50, 50, 50, 0.17); box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
} }
</style> </style>
</head> </head>


<body> <body>
<!-- This file lives in public/422.html --> <!-- This file lives in public/422.html -->
<div class="dialog"> <div class="dialog">
<h1>The change you wanted was rejected.</h1> <div>
<p>Maybe you tried to change something you didn't have access to.</p> <h1>The change you wanted was rejected.</h1>
<p>Maybe you tried to change something you didn't have access to.</p>
</div>
<p>If you are the application owner check the logs for more information.</p>
</div> </div>
<p>If you are the application owner check the logs for more information.</p>
</body> </body>
</html> </html>
27 changes: 17 additions & 10 deletions railties/lib/rails/generators/rails/app/templates/public/500.html
Expand Up @@ -2,17 +2,23 @@
<html> <html>
<head> <head>
<title>We're sorry, but something went wrong (500)</title> <title>We're sorry, but something went wrong (500)</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
<style> <style>
body { body {
background-color: #EFEFEF; background-color: #EFEFEF;
color: #2E2F30; color: #2E2F30;
text-align: center; text-align: center;
font-family: arial, sans-serif; font-family: arial, sans-serif;
margin: 0;
} }


div.dialog { div.dialog {
width: 25em; width: 95%;
margin: 4em auto 0 auto; max-width: 33em;
margin: 4em auto 0;
}

div.dialog > div {
border: 1px solid #CCC; border: 1px solid #CCC;
border-right-color: #999; border-right-color: #999;
border-left-color: #999; border-left-color: #999;
Expand All @@ -21,7 +27,7 @@
border-top-left-radius: 9px; border-top-left-radius: 9px;
border-top-right-radius: 9px; border-top-right-radius: 9px;
background-color: white; background-color: white;
padding: 7px 4em 0 4em; padding: 7px 12% 0;
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17); box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
} }


Expand All @@ -31,10 +37,9 @@
line-height: 1.5em; line-height: 1.5em;
} }


body > p { div.dialog > p {
width: 33em; margin: 0 0 1em;
margin: 0 auto 1em; padding: 1em;
padding: 1em 0;
background-color: #F7F7F7; background-color: #F7F7F7;
border: 1px solid #CCC; border: 1px solid #CCC;
border-right-color: #999; border-right-color: #999;
Expand All @@ -44,16 +49,18 @@
border-bottom-right-radius: 4px; border-bottom-right-radius: 4px;
border-top-color: #DADADA; border-top-color: #DADADA;
color: #666; color: #666;
box-shadow:0 3px 8px rgba(50, 50, 50, 0.17); box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
} }
</style> </style>
</head> </head>


<body> <body>
<!-- This file lives in public/500.html --> <!-- This file lives in public/500.html -->
<div class="dialog"> <div class="dialog">
<h1>We're sorry, but something went wrong.</h1> <div>
<h1>We're sorry, but something went wrong.</h1>
</div>
<p>If you are the application owner check the logs for more information.</p>
</div> </div>
<p>If you are the application owner check the logs for more information.</p>
</body> </body>
</html> </html>
2 changes: 1 addition & 1 deletion railties/test/application/middleware/exceptions_test.rb
Expand Up @@ -73,7 +73,7 @@ def index


assert_nothing_raised(ActionController::RoutingError) do assert_nothing_raised(ActionController::RoutingError) do
get '/foo' get '/foo'
assert_match "The page you were looking for doesn't exist.", last_response.body assert_match "The page you were looking for doesn't exist.", last_response.body
end end
end end


Expand Down

0 comments on commit 3bd3c96

Please sign in to comment.