Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
81092c01
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
81092c01
编写于
2月 23, 2012
作者:
D
Dmitriy Zaporozhets
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Status codes for errors, New error pages
上级
7d279f93
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
71 addition
and
41 deletion
+71
-41
app/controllers/application_controller.rb
app/controllers/application_controller.rb
+4
-4
app/controllers/projects_controller.rb
app/controllers/projects_controller.rb
+1
-0
public/404.html
public/404.html
+3
-13
public/422.html
public/422.html
+3
-12
public/500.html
public/500.html
+3
-12
public/static.css
public/static.css
+57
-0
未找到文件。
app/controllers/application_controller.rb
浏览文件 @
81092c01
...
...
@@ -9,7 +9,7 @@ class ApplicationController < ActionController::Base
end
rescue_from
ActiveRecord
::
RecordNotFound
do
|
exception
|
render
"errors/not_found"
,
:layout
=>
"error"
render
"errors/not_found"
,
:layout
=>
"error"
,
:status
=>
404
end
layout
:layout_by_resource
...
...
@@ -58,15 +58,15 @@ class ApplicationController < ActionController::Base
end
def
access_denied!
render
"errors/access_denied"
,
:layout
=>
"error"
render
"errors/access_denied"
,
:layout
=>
"error"
,
:status
=>
404
end
def
not_found!
render
"errors/not_found"
,
:layout
=>
"error"
render
"errors/not_found"
,
:layout
=>
"error"
,
:status
=>
404
end
def
git_not_found!
render
"errors/git_not_found"
,
:layout
=>
"error"
render
"errors/git_not_found"
,
:layout
=>
"error"
,
:status
=>
404
end
def
method_missing
(
method_sym
,
*
arguments
,
&
block
)
...
...
app/controllers/projects_controller.rb
浏览文件 @
81092c01
...
...
@@ -114,6 +114,7 @@ class ProjectsController < ApplicationController
def
project
@project
||=
Project
.
find_by_code
(
params
[
:id
])
@project
||
render_404
end
def
determine_layout
...
...
public/404.html
浏览文件 @
81092c01
...
...
@@ -2,22 +2,12 @@
<html>
<head>
<title>
The page you were looking for doesn't exist (404)
</title>
<style
type=
"text/css"
>
body
{
background-color
:
#EAEAEA
;
color
:
#666
;
text-align
:
center
;
font-family
:
arial
,
sans-serif
;
}
div
.dialog
{
width
:
600px
;
padding
:
0
4em
;
margin
:
4em
auto
0
auto
;
}
h1
{
font-size
:
48px
;
color
:
#444
;
line-height
:
1.5em
;
}
h2
{
font-size
:
24px
;
color
:
#666
;
line-height
:
1.5em
;
}
</style>
<link
href=
"static.css"
media=
"screen"
rel=
"stylesheet"
type=
"text/css"
/>
</head>
<body>
<!-- This file lives in public/404.html -->
<div
class=
"dialog"
>
<h1>
404
</h1>
<h1>
404
</h1>
<div
class=
"alert-message block-message error"
>
<h2>
The page you were looking for doesn't exist.
</h2>
<p>
You may have mistyped the address or the page may have moved.
</p>
</div>
...
...
public/422.html
浏览文件 @
81092c01
...
...
@@ -2,22 +2,13 @@
<html>
<head>
<title>
The change you wanted was rejected (422)
</title>
<style
type=
"text/css"
>
body
{
background-color
:
#EAEAEA
;
color
:
#666
;
text-align
:
center
;
font-family
:
arial
,
sans-serif
;
}
div
.dialog
{
width
:
600px
;
padding
:
0
4em
;
margin
:
4em
auto
0
auto
;
}
h1
{
font-size
:
48px
;
color
:
#444
;
line-height
:
1.5em
;
}
h2
{
font-size
:
24px
;
color
:
#666
;
line-height
:
1.5em
;
}
</style>
<link
href=
"static.css"
media=
"screen"
rel=
"stylesheet"
type=
"text/css"
/>
</head>
<body>
<!-- This file lives in public/422.html -->
<
div
class=
"dialog"
>
<h1>
422
</h1
>
<
h1>
422
</h1
>
<div
class=
"alert-message block-message error"
>
<h2>
The change you wanted was rejected.
</h2>
<p>
Maybe you tried to change something you didn't have access to.
</p>
</div>
...
...
public/500.html
浏览文件 @
81092c01
...
...
@@ -2,22 +2,13 @@
<html>
<head>
<title>
We're sorry, but something went wrong (500)
</title>
<style
type=
"text/css"
>
body
{
background-color
:
#EAEAEA
;
color
:
#666
;
text-align
:
center
;
font-family
:
arial
,
sans-serif
;
}
div
.dialog
{
width
:
600px
;
padding
:
0
4em
;
margin
:
4em
auto
0
auto
;
}
h1
{
font-size
:
48px
;
color
:
#444
;
line-height
:
1.5em
;
}
h2
{
font-size
:
24px
;
color
:
#666
;
line-height
:
1.5em
;
}
</style>
<link
href=
"static.css"
media=
"screen"
rel=
"stylesheet"
type=
"text/css"
/>
</head>
<body>
<!-- This file lives in public/500.html -->
<
div
class=
"dialog"
>
<h1>
500
</h1
>
<
h1>
500
</h1
>
<div
class=
"alert-message block-message error"
>
<h2>
We're sorry, but something went wrong.
</h2>
<p>
We've been notified about this issue and we'll take a look at it shortly.
</p>
</div>
...
...
public/static.css
0 → 100644
浏览文件 @
81092c01
body
{
color
:
#666
;
text-align
:
center
;
font-family
:
arial
,
sans-serif
;
margin
:
0
;
padding
:
0
;
}
h1
{
font-size
:
48px
;
color
:
#444
;
line-height
:
1.5em
;
}
h2
{
font-size
:
24px
;
color
:
#666
;
line-height
:
1.5em
;
}
.alert-message
{
position
:
relative
;
padding
:
7px
15px
;
margin-bottom
:
18px
;
color
:
#404040
;
background-color
:
#eedc94
;
background-repeat
:
repeat-x
;
background-image
:
-khtml-gradient
(
linear
,
left
top
,
left
bottom
,
from
(
#fceec1
),
to
(
#eedc94
));
background-image
:
-moz-linear-gradient
(
top
,
#fceec1
,
#eedc94
);
background-image
:
-ms-linear-gradient
(
top
,
#fceec1
,
#eedc94
);
background-image
:
-webkit-gradient
(
linear
,
left
top
,
left
bottom
,
color-stop
(
0%
,
#fceec1
),
color-stop
(
100%
,
#eedc94
));
background-image
:
-webkit-linear-gradient
(
top
,
#fceec1
,
#eedc94
);
background-image
:
-o-linear-gradient
(
top
,
#fceec1
,
#eedc94
);
background-image
:
linear-gradient
(
top
,
#fceec1
,
#eedc94
);
filter
:
progid
:
DXImageTransform
.
Microsoft
.
gradient
(
startColorstr
=
'#FFFCEEC1'
,
endColorstr
=
'#FFEEDC94'
,
GradientType
=
0
);
text-shadow
:
0
-1px
0
rgba
(
0
,
0
,
0
,
0.25
);
border-color
:
#eedc94
#eedc94
#e4c652
;
border-color
:
rgba
(
0
,
0
,
0
,
0.1
)
rgba
(
0
,
0
,
0
,
0.1
)
fadein
(
rgba
(
0
,
0
,
0
,
0.1
),
15%
);
text-shadow
:
0
1px
0
rgba
(
255
,
255
,
255
,
0.5
);
border-width
:
1px
;
border-style
:
solid
;
-webkit-box-shadow
:
inset
0
1px
0
rgba
(
255
,
255
,
255
,
0.25
);
-moz-box-shadow
:
inset
0
1px
0
rgba
(
255
,
255
,
255
,
0.25
);
box-shadow
:
inset
0
1px
0
rgba
(
255
,
255
,
255
,
0.25
);
}
.alert-message
.close
{
margin-top
:
1px
;
*
margin-top
:
0
;
}
.alert-message
a
{
font-weight
:
bold
;
color
:
#404040
;
}
.alert-message.danger
p
a
,
.alert-message.error
p
a
,
.alert-message.success
p
a
,
.alert-message.info
p
a
{
color
:
#404040
;
}
.alert-message
h5
{
line-height
:
18px
;
}
.alert-message
p
{
margin-bottom
:
0
;
}
.alert-message
div
{
margin-top
:
5px
;
margin-bottom
:
2px
;
line-height
:
28px
;
}
.alert-message.block-message.error
{
background
:
#FDDFDE
;
border-color
:
#FBC7C6
;
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录