Skip to content

Commit 7166507

Browse files
committed
Make static error pages responsive
1 parent eb6dd34 commit 7166507

File tree

4 files changed

+54
-33
lines changed

4 files changed

+54
-33
lines changed

railties/lib/rails/generators/rails/app/templates/public/404.html

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,23 @@
22
<html>
33
<head>
44
<title>The page you were looking for doesn't exist (404)</title>
5+
<meta name="viewport" content="width=device-width,initial-scale=1">
56
<style>
67
body {
78
background-color: #EFEFEF;
89
color: #2E2F30;
910
text-align: center;
1011
font-family: arial, sans-serif;
12+
margin: 0;
1113
}
1214

1315
div.dialog {
14-
width: 25em;
15-
margin: 4em auto 0 auto;
16+
width: 95%;
17+
max-width: 33em;
18+
margin: 4em auto 0;
19+
}
20+
21+
div.dialog > div {
1622
border: 1px solid #CCC;
1723
border-right-color: #999;
1824
border-left-color: #999;
@@ -21,7 +27,7 @@
2127
border-top-left-radius: 9px;
2228
border-top-right-radius: 9px;
2329
background-color: white;
24-
padding: 7px 4em 0 4em;
30+
padding: 7px 12% 0;
2531
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
2632
}
2733

@@ -31,10 +37,9 @@
3137
line-height: 1.5em;
3238
}
3339

34-
body > p {
35-
width: 33em;
36-
margin: 0 auto 1em;
37-
padding: 1em 0;
40+
div.dialog > p {
41+
margin: 0 0 1em;
42+
padding: 1em;
3843
background-color: #F7F7F7;
3944
border: 1px solid #CCC;
4045
border-right-color: #999;
@@ -44,17 +49,19 @@
4449
border-bottom-right-radius: 4px;
4550
border-top-color: #DADADA;
4651
color: #666;
47-
box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
52+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
4853
}
4954
</style>
5055
</head>
5156

5257
<body>
5358
<!-- This file lives in public/404.html -->
5459
<div class="dialog">
55-
<h1>The page you were looking for doesn't exist.</h1>
56-
<p>You may have mistyped the address or the page may have moved.</p>
60+
<div>
61+
<h1>The page you were looking for doesn't exist.</h1>
62+
<p>You may have mistyped the address or the page may have moved.</p>
63+
</div>
64+
<p>If you are the application owner check the logs for more information.</p>
5765
</div>
58-
<p>If you are the application owner check the logs for more information.</p>
5966
</body>
6067
</html>

railties/lib/rails/generators/rails/app/templates/public/422.html

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,23 @@
22
<html>
33
<head>
44
<title>The change you wanted was rejected (422)</title>
5+
<meta name="viewport" content="width=device-width,initial-scale=1">
56
<style>
67
body {
78
background-color: #EFEFEF;
89
color: #2E2F30;
910
text-align: center;
1011
font-family: arial, sans-serif;
12+
margin: 0;
1113
}
1214

1315
div.dialog {
14-
width: 25em;
15-
margin: 4em auto 0 auto;
16+
width: 95%;
17+
max-width: 33em;
18+
margin: 4em auto 0;
19+
}
20+
21+
div.dialog > div {
1622
border: 1px solid #CCC;
1723
border-right-color: #999;
1824
border-left-color: #999;
@@ -21,7 +27,7 @@
2127
border-top-left-radius: 9px;
2228
border-top-right-radius: 9px;
2329
background-color: white;
24-
padding: 7px 4em 0 4em;
30+
padding: 7px 12% 0;
2531
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
2632
}
2733

@@ -31,10 +37,9 @@
3137
line-height: 1.5em;
3238
}
3339

34-
body > p {
35-
width: 33em;
36-
margin: 0 auto 1em;
37-
padding: 1em 0;
40+
div.dialog > p {
41+
margin: 0 0 1em;
42+
padding: 1em;
3843
background-color: #F7F7F7;
3944
border: 1px solid #CCC;
4045
border-right-color: #999;
@@ -44,17 +49,19 @@
4449
border-bottom-right-radius: 4px;
4550
border-top-color: #DADADA;
4651
color: #666;
47-
box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
52+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
4853
}
4954
</style>
5055
</head>
5156

5257
<body>
5358
<!-- This file lives in public/422.html -->
5459
<div class="dialog">
55-
<h1>The change you wanted was rejected.</h1>
56-
<p>Maybe you tried to change something you didn't have access to.</p>
60+
<div>
61+
<h1>The change you wanted was rejected.</h1>
62+
<p>Maybe you tried to change something you didn't have access to.</p>
63+
</div>
64+
<p>If you are the application owner check the logs for more information.</p>
5765
</div>
58-
<p>If you are the application owner check the logs for more information.</p>
5966
</body>
6067
</html>

railties/lib/rails/generators/rails/app/templates/public/500.html

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,23 @@
22
<html>
33
<head>
44
<title>We're sorry, but something went wrong (500)</title>
5+
<meta name="viewport" content="width=device-width,initial-scale=1">
56
<style>
67
body {
78
background-color: #EFEFEF;
89
color: #2E2F30;
910
text-align: center;
1011
font-family: arial, sans-serif;
12+
margin: 0;
1113
}
1214

1315
div.dialog {
14-
width: 25em;
15-
margin: 4em auto 0 auto;
16+
width: 95%;
17+
max-width: 33em;
18+
margin: 4em auto 0;
19+
}
20+
21+
div.dialog > div {
1622
border: 1px solid #CCC;
1723
border-right-color: #999;
1824
border-left-color: #999;
@@ -21,7 +27,7 @@
2127
border-top-left-radius: 9px;
2228
border-top-right-radius: 9px;
2329
background-color: white;
24-
padding: 7px 4em 0 4em;
30+
padding: 7px 12% 0;
2531
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
2632
}
2733

@@ -31,10 +37,9 @@
3137
line-height: 1.5em;
3238
}
3339

34-
body > p {
35-
width: 33em;
36-
margin: 0 auto 1em;
37-
padding: 1em 0;
40+
div.dialog > p {
41+
margin: 0 0 1em;
42+
padding: 1em;
3843
background-color: #F7F7F7;
3944
border: 1px solid #CCC;
4045
border-right-color: #999;
@@ -44,16 +49,18 @@
4449
border-bottom-right-radius: 4px;
4550
border-top-color: #DADADA;
4651
color: #666;
47-
box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
52+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
4853
}
4954
</style>
5055
</head>
5156

5257
<body>
5358
<!-- This file lives in public/500.html -->
5459
<div class="dialog">
55-
<h1>We're sorry, but something went wrong.</h1>
60+
<div>
61+
<h1>We're sorry, but something went wrong.</h1>
62+
</div>
63+
<p>If you are the application owner check the logs for more information.</p>
5664
</div>
57-
<p>If you are the application owner check the logs for more information.</p>
5865
</body>
5966
</html>

railties/test/application/middleware/exceptions_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def index
7373

7474
assert_nothing_raised(ActionController::RoutingError) do
7575
get '/foo'
76-
assert_match "The page you were looking for doesn't exist.", last_response.body
76+
assert_match "The page you were looking for doesn't exist.", last_response.body
7777
end
7878
end
7979

0 commit comments

Comments
 (0)