add about & dialog add modal

This commit is contained in:
Liang Ding 2014-10-20 22:27:19 +08:00
parent 8e5460cefa
commit 068a069503
7 changed files with 60 additions and 5 deletions

View File

@ -16,9 +16,16 @@
"Password": "admin",
"Workspace": "{pwd}/data/user_workspaces/admin",
"LatestSessionContent": {
"FileTree": [],
"Files": [],
"CurrentFile": ""
"FileTree": [
"D:\\GoGoGo\\src\\github.com\\b3log\\wide\\data\\user_workspaces\\admin\\src\\mytest",
"D:\\GoGoGo\\src\\github.com\\b3log\\wide\\data\\user_workspaces\\admin\\src\\mytest\\hello",
"D:\\GoGoGo\\src\\github.com\\b3log\\wide\\data\\user_workspaces\\admin\\src\\mytest\\time",
"D:\\Go\\src\\pkg"
],
"Files": [
"D:\\GoGoGo\\src\\github.com\\b3log\\wide\\data\\user_workspaces\\admin\\src\\mytest\\hello\\main.go"
],
"CurrentFile": "D:\\GoGoGo\\src\\github.com\\b3log\\wide\\data\\user_workspaces\\admin\\src\\mytest\\hello\\main.go"
}
}
]

20
main.go
View File

@ -202,6 +202,25 @@ func startHandler(w http.ResponseWriter, r *http.Request) {
t.Execute(w, model)
}
// 关于页请求处理.
func aboutHandler(w http.ResponseWriter, r *http.Request) {
i18n.Load()
model := map[string]interface{}{"conf": conf.Wide, "i18n": i18n.GetAll(r), "locale": i18n.GetLocale(r),
"ver": Ver}
t, err := template.ParseFiles("view/about.html")
if nil != err {
glog.Error(err)
http.Error(w, err.Error(), 500)
return
}
t.Execute(w, model)
}
// 主程序入口.
func main() {
runtime.GOMAXPROCS(conf.Wide.MaxProcs)
@ -213,6 +232,7 @@ func main() {
http.HandleFunc("/logout", handlerWrapper(logoutHandler))
http.HandleFunc("/", handlerWrapper(indexHandler))
http.HandleFunc("/start", handlerWrapper(startHandler))
http.HandleFunc("/about", handlerWrapper(aboutHandler))
// 静态资源
http.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir("static"))))

0
static/css/about.css Normal file
View File

View File

@ -15,6 +15,7 @@
filter: alpha(opacity=30);
display: none;
background-color: #000000;
z-index: 99;
}
.dialog-panel {
@ -63,11 +64,15 @@
text-align: right;
}
.dialog-footer button {
margin: 0 5px;
}
#dialogRemoveConfirm,
.dialog-prompt,
.dialog-form,
#dialogAlert {
padding: 10px 20px 0;
padding: 10px 15px 0;
overflow: hidden;
}

View File

@ -20,6 +20,7 @@ var wide = {
$("#dialogAlert").dialog({
"modal": true,
"height": 26,
"width": 260,
"title": config.label.tip,
@ -31,6 +32,7 @@ var wide = {
});
$("#dialogRemoveConfirm").dialog({
"modal": true,
"height": 26,
"width": 260,
"title": config.label.delete,
@ -79,6 +81,7 @@ var wide = {
});
$("#dialogNewFilePrompt").dialog({
"modal": true,
"height": 52,
"width": 260,
"title": config.label.create_file,
@ -152,6 +155,7 @@ var wide = {
});
$("#dialogNewDirPrompt").dialog({
"modal": true,
"height": 52,
"width": 260,
"title": config.label.create_dir,
@ -191,6 +195,7 @@ var wide = {
});
$("#dialogGoLinePrompt").dialog({
"modal": true,
"height": 52,
"width": 260,
"title": config.label.goto_line,
@ -229,6 +234,7 @@ var wide = {
});
$("#dialogSearchForm").dialog({
"modal": true,
"height": 62,
"width": 260,
"title": config.label.search,
@ -614,6 +620,9 @@ var wide = {
wide._save();
break;
}
},
openAbout: function () {
}
};

14
view/about.html Normal file
View File

@ -0,0 +1,14 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>{{.i18n.wide}} - {{.i18n.about}}</title>
<link rel="stylesheet" href="{{.conf.StaticServer}}/static/css/base.css?{{.conf.StaticResourceVersion}}">
<link rel="stylesheet" href="{{.conf.StaticServer}}/static/css/about.css?{{.conf.StaticResourceVersion}}">
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
</head>
<body>
about
<script type="text/javascript" src="{{.conf.StaticServer}}/static/js/lib/jquery-2.1.1.min.js"></script>
</body>
</html>

View File

@ -83,7 +83,7 @@
<li onclick="editors.openStartPage()">
<span>{{.i18n.start_page}}</span>
</li>
<li onclick="window.open('/doc/{{.locale}}/index.html')">
<li onclick="wide.openAbout()">
<span>{{.i18n.about}}</span>
</li>
</ul>