Commit f782e4a4 authored by fuhai999@gmail.com's avatar fuhai999@gmail.com
Browse files

v2.0.2

parent e97f8559
No related merge requests found
Showing with 104 additions and 97 deletions
+104 -97
......@@ -81,5 +81,14 @@ public abstract class AdminControllerBase extends ControllerBase {
}
}
@Override
public void renderError(int errorCode) {
if (errorCode == 404) {
renderError(errorCode, "/WEB-INF/views/admin/error/404.html");
} else {
renderError(errorCode, "/WEB-INF/views/admin/error/500.html");
}
}
}
......@@ -37,6 +37,14 @@ public class JPressRenderFactory extends JbootRenderFactory {
@Override
public Render getErrorRender(int errorCode) {
if (JPressHandler.getCurrentTarget().startsWith("/admin/")) {
if (errorCode == 404) {
return getErrorRender(errorCode, "/WEB-INF/views/admin/error/404.html");
} else {
return getErrorRender(errorCode, "/WEB-INF/views/admin/error/500.html");
}
}
Controller currentController = JbootControllerContext.get();
if (currentController == null) {
......
......@@ -34,6 +34,7 @@ public class WebInitializer extends JbootAppListenerBase {
try {
engine.addSharedFunction("/WEB-INF/views/admin/_layout/_layout.html");
engine.addSharedFunction("/WEB-INF/views/admin/_layout/_layer.html");
engine.addSharedFunction("/WEB-INF/views/admin/_layout/_errpage.html");
engine.addSharedFunction("/WEB-INF/views/admin/_layout/_paginate.html");
engine.addSharedFunction("/WEB-INF/views/ucenter/_layout/_layout.html");
engine.addSharedStaticMethod(PermissionKits.class);
......
#define errpage()
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<title>发生错误了...</title>
<link rel="stylesheet" href="#(CPATH)/static/components/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" href="#(CPATH)/static/components/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" href="#(CPATH)/static/adminlte/css/AdminLTE.min.css">
<link rel="stylesheet" href="#(CPATH)/static/adminlte/css/skins/skin-blue.min.css">
<!--[if lt IE 9]>
<script src="#(CPATH)/static/components/html5shiv/html5shiv.min.js"></script>
<script src="#(CPATH)/static/components/respond/respond.min.js"></script>
<![endif]-->
<script>
var jpress = {
cpath: '#(CPATH)'
}
</script>
<style>
.error-page > .error-content {
margin-left: 0;
display: block;
text-align: center;
}
.error-title {
font-size: 100px;
text-align: center;
}
.error-content > p {
padding-left: 20px;
padding-right: 20px;
}
</style>
#@css?()
</head>
<body class="hold-transition ">
<div class="wrapper">
#@content()
</div>
<!-- ./wrapper -->
<script src="#(CPATH)/static/components/jquery/jquery.min.js"></script>
<script src="#(CPATH)/static/components/bootstrap/js/bootstrap.min.js"></script>
<script src="#(CPATH)/static/components/fastclick/fastclick.js"></script>
<script src="#(CPATH)/static/adminlte/js/adminlte.min.js"></script>
#@script?()
</body>
</html>
#end
......@@ -4,6 +4,7 @@
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<title>JPress后台</title>
<link rel="stylesheet" href="#(CPATH)/static/components/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" href="#(CPATH)/static/components/font-awesome/css/font-awesome.min.css">
......
#@layout()
#define css()
<style>
.switchery-small {
margin-top: 0px;
}
</style>
#end
#@errpage()
#define content()
<div class="content-wrapper">
<section class="content">
<div class="error-page">
<h2 class="headline text-yellow"> 404</h2>
<div class="error-content">
<h3><i class="fa fa-warning text-yellow"></i> Oops! Page not found.</h3>
<p>
We could not find the page you were looking for.
Meanwhile, you may <a href="../../index.html">return to dashboard</a> or try using the search form.
</p>
<form class="search-form">
<div class="input-group">
<input type="text" name="search" class="form-control" placeholder="Search">
<div class="error-page">
<div class="error-content">
<div class="input-group-btn">
<button type="submit" name="submit" class="btn btn-warning btn-flat"><i
class="fa fa-search"></i>
</button>
</div>
</div>
</form>
</div>
</div>
</section>
<h2 class="error-title text-yellow"> 404</h2>
<h3><i class="fa fa-warning text-yellow"></i> 诶呀! 页面找不到啦。</h3>
<p>
我们找不到您要查找的页面,您可以访问 <a href="http://www.jpress.io" target="_blank">JPress</a> 获得帮助。
</p>
</div>
</div>
#end
#@layout()
#define css()
<style>
.switchery-small {
margin-top: 0px;
}
</style>
#end
#@errpage()
#define content()
<div class="content-wrapper">
<section class="content">
<div class="error-page">
<h2 class="headline text-yellow"> 500</h2>
<div class="error-content">
<h3><i class="fa fa-warning text-yellow"></i> Oops! Page not found.</h3>
<p>
We could not find the page you were looking for.
Meanwhile, you may <a href="../../index.html">return to dashboard</a> or try using the search form.
</p>
<form class="search-form">
<div class="input-group">
<input type="text" name="search" class="form-control" placeholder="Search">
<div class="error-page">
<div class="error-content">
<div class="input-group-btn">
<button type="submit" name="submit" class="btn btn-warning btn-flat"><i
class="fa fa-search"></i>
</button>
</div>
</div>
</form>
</div>
</div>
</section>
<h2 class="error-title text-yellow"> 500</h2>
<h3><i class="fa fa-warning text-yellow"></i> 诶呀! 系统发生错误啦。</h3>
<p>
不要担心,我们马上就着手解决这个问题。或者您可以访问 <a href="http://www.jpress.io" target="_blank">JPress</a> 获得帮助。
</p>
</div>
</div>
#end
#@layout()
#define css()
<style>
.error-content {
margin-top: 100px;
}
.error-page > .error-content {
margin-left: 0;
display: block;
}
.error-page > .error-content > h3 {
font-weight: 300;
font-size: 35px;
}
</style>
#end
#@errpage()
#define content()
<div class="content-wrapper">
<section class="content">
<div class="error-page">
<div class="error-content">
<h3><i class="fa fa-warning text-yellow"></i> 诶呀! 您还没有权限操作此页面。</h3>
</div>
</div>
</section>
<div class="error-page">
<div class="error-content">
<h2 class="error-title text-yellow"> 403</h2>
<h3><i class="fa fa-warning text-yellow"></i> 抱歉! 您没有权限操作此页面。</h3>
</div>
</div>
#end
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment