add customize 404

This commit is contained in:
wy65701436 2017-04-11 00:05:28 -07:00
parent 0b1f7664c4
commit a8aa0ad9b3
3 changed files with 108 additions and 0 deletions

View File

@ -0,0 +1,14 @@
package controllers
import (
"github.com/astaxie/beego"
)
type ErrorController struct {
beego.Controller
}
func (ec *ErrorController) Error404() {
ec.Data["content"] = "page not found"
ec.TplName = "404.tpl"
}

View File

@ -107,4 +107,7 @@ func initRouters() {
//external service that hosted on harbor process:
beego.Router("/service/notifications", &service.NotificationHandler{})
beego.Router("/service/token", &token.Handler{})
//Error pages
beego.ErrorController(&controllers.ErrorController{})
}

91
src/ui/views/404.tpl Normal file
View File

@ -0,0 +1,91 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>404 - Page Not Found</title>
<style>
*{
maring: 0;
padding: 0;
}
a:link{
color: #1f3759;
text-decoration: none;
}
a:active{
color: #1f3759;
text-decoration: none;
}
a:hover{
color: #9fb7d9;
text-decoration: none;
}
a:visited{
color: #1f3759;
text-decoration: none;
}
a.underline, .underline{
text-decoration: underline;
}
#content{
margin: 0 auto;
width: 800px;
}
#main-body{
text-align: center;
}
.wrapper-back {
position: absolute;
top: 50%;
height: 240px;
margin-top: -120px;
text-align: center;
left: 50%;
margin-left: -300px;
}
.status-code {
font-weight: bolder;
font-size: 4em;
vertical-align: middle;
}
.status-text {
font-weight: bold;
font-size: 3em;
margin-left: 10px;
vertical-align: middle;
}
.status-subtitle {
font-size: 18px;
}
.second-number {
font-weight: bold;
font-size: 2em;
color: #EB8D00;
}
</style>
</head>
<body>
<div id="content">
<div id="main-body">
<div>
<span class="status-code">404</span>
<span class="status-text">Page Not Found</span>
</div>
<div class="status-subtitle">
<p class="big-font"> <a href="/harbor" class="underline">Home</p>
</div>
</div>
</div>
</body>
</html>