修改403、403页面显示

This commit is contained in:
sw 2014-10-13 10:31:40 +08:00
parent 7a710a4a8f
commit 13ee0dc9b2
4 changed files with 124 additions and 22 deletions

View File

@ -495,12 +495,14 @@ class ApplicationController < ActionController::Base
def render_403(options={})
@project = nil
render_error({:message => :notice_not_authorized, :status => 403}.merge(options))
#render_error({:message => :notice_not_authorized, :status => 403}.merge(options))
render :template => 'common/403'
return false
end
def render_404(options={})
render_error({:message => :notice_file_not_found, :status => 404}.merge(options))
#render_error({:message => :notice_file_not_found, :status => 404}.merge(options))
render :template => 'common/404'
return false
end

41
app/views/common/403.html Normal file
View File

@ -0,0 +1,41 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>没有访问权限</title>
<style>
body{ font-size:12px; font-family:"微软雅黑","宋体"; line-height:1.9; background:#fff; font-style:normal;}
div,html,img,ul,li,p,body,h1,h2,h3,h4,p,a,table,tr,td,fieldset,input,span{ margin:0; padding:0;}
div,img,tr,td{ border:0;}
table,tr,td{border:0 cellspacing:0; cellpadding:0;}
ul,li{ list-style-type:none}
.cl{ clear:both; overflow:hidden; }
a{ text-decoration:none; }
a:hover{ }
.error_content{ width:550px; height:200px; margin:0 auto; padding:10px 0;}
.error_left{color:#15bccf; font-size:100px; font-weight:bold; font-style:oblique; width:200px; height:120px; padding-right:30px; float:left;}
.error_right{ width:240px; height:120px; float:left;color:#15bccf; font-size: 17px; font-weight:bold; padding-left:30px; margin-top:40px; border-left:1px dashed #CCC; }
.error_link{ margin-top:8px;}
.error_link a{ display:block; width:80px; height:28px; font-size:14px; font-weight:bold; color:#fff; text-align:center; background:#15bccf; float:left; margin-right:10px;}
.error_link a:hover{ background:#ff8417;}
</style>
</head>
<body>
<div class="error_content">
<div class="error_left">403</div>
<div class="error_right">
<p>ERROR FORBIDDEN<br />
没有访问权限!建议您</p>
<div class="error_link">
<!---<a href="http://forge.trustie.net/" target="_blank">返回首页</a>---->
<a href="#" target="_blank">后退一步</a>
<a href="http://user.trustie.net/users/5/user_newfeedback" target="_blank">给我留言</a>
</div>
</div>
</div>
</body>
</html>

41
app/views/common/404.html Normal file
View File

@ -0,0 +1,41 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>页面不见了</title>
<style>
body{ font-size:12px; font-family:"微软雅黑","宋体"; line-height:1.9; background:#fff;}
div,html,img,ul,li,p,body,h1,h2,h3,h4,p,a,table,tr,td,fieldset,input,span{ margin:0; padding:0;}
div,img,tr,td{ border:0;}
table,tr,td{border:0 cellspacing:0; cellpadding:0;}
ul,li{ list-style-type:none}
.cl{ clear:both; overflow:hidden; }
a{ text-decoration:none; }
a:hover{ }
.error_content{ width:550px; height:200px; margin:0 auto; padding:10px 0;}
.error_left{color:#15bccf; font-size:100px; font-weight:bold; font-style:oblique; width:200px; height:120px; padding-right:30px; float:left;}
.error_right{ width:240px; height:120px; float:left;color:#15bccf; font-size: 18px; font-weight:bold; padding-left:30px; margin-top:40px; border-left:1px dashed #CCC; }
.error_link{ margin-top:8px;}
.error_link a{ display:block; width:80px; height:28px; font-size:14px; font-weight:bold; color:#fff; text-align:center; background:#15bccf; float:left; margin-right:10px;}
.error_link a:hover{ background:#ff8417;}
</style>
</head>
<body>
<div class="error_content">
<div class="error_left">404</div>
<div class="error_right">
<p><span style="font-size:24px;">ERROR PAGE</span><br />
页面不见了!建议您</p>
<div class="error_link">
<!---<a href="http://forge.trustie.net/" target="_blank">返回首页</a>---->
<a href="#" target="_blank">后退一步</a>
<a href="http://user.trustie.net/users/5/user_newfeedback" target="_blank">给我留言</a>
</div>
</div>
</div>
</body>
</html>

View File

@ -1,23 +1,41 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<title>Trustie 404 error</title>
<style>
body{
font-family: Trebuchet MS,Georgia,"Times New Roman",serif;
color:#303030;
margin:10px;
}
h1{
font-size:1.5em;
}
p{
font-size:0.8em;
}
</style>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>页面不见了</title>
<style>
body{ font-size:12px; font-family:"微软雅黑","宋体"; line-height:1.9; background:#fff;}
div,html,img,ul,li,p,body,h1,h2,h3,h4,p,a,table,tr,td,fieldset,input,span{ margin:0; padding:0;}
div,img,tr,td{ border:0;}
table,tr,td{border:0 cellspacing:0; cellpadding:0;}
ul,li{ list-style-type:none}
.cl{ clear:both; overflow:hidden; }
a{ text-decoration:none; }
a:hover{ }
.content{ width:550px; height:200px; margin:0 auto; padding:10px 0;}
.left{color:#15bccf; font-size:100px; font-weight:bold; font-style:oblique; width:200px; height:120px; padding-right:30px; float:left;}
.right{ width:240px; height:120px; float:left;color:#15bccf; font-size: 18px; font-weight:bold; padding-left:30px; margin-top:40px; border-left:1px dashed #CCC; }
.link{ margin-top:8px;}
.link a{ display:block; width:80px; height:30px; font-size:14px; font-weight:bold; color:#fff; text-align:center; background:#15bccf; float:left; margin-right:10px;}
.link a:hover{ background:#ff8417;}
</style>
</head>
<body>
<h1>Page not found</h1>
<p>The page you were trying to access doesn't exist or has been removed.</p>
<p><a href="javascript:history.back()">Back</a></p>
<div class="content">
<div class="left">404</div>
<div class="right">
<p><span style="font-size:24px;">ERROR PAGE</span><br />
页面不见了!建议您</p>
<div class="link">
<!---<a href="http://forge.trustie.net/" target="_blank">返回首页</a>---->
<a href="#" target="_blank">后退一步</a>
<a href="http://user.trustie.net/users/5/user_newfeedback" target="_blank">给我留言</a>
</div>
</div>
</div>
</body>
</html>