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", "Password": "admin",
"Workspace": "{pwd}/data/user_workspaces/admin", "Workspace": "{pwd}/data/user_workspaces/admin",
"LatestSessionContent": { "LatestSessionContent": {
"FileTree": [], "FileTree": [
"Files": [], "D:\\GoGoGo\\src\\github.com\\b3log\\wide\\data\\user_workspaces\\admin\\src\\mytest",
"CurrentFile": "" "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) 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() { func main() {
runtime.GOMAXPROCS(conf.Wide.MaxProcs) runtime.GOMAXPROCS(conf.Wide.MaxProcs)
@ -213,6 +232,7 @@ func main() {
http.HandleFunc("/logout", handlerWrapper(logoutHandler)) http.HandleFunc("/logout", handlerWrapper(logoutHandler))
http.HandleFunc("/", handlerWrapper(indexHandler)) http.HandleFunc("/", handlerWrapper(indexHandler))
http.HandleFunc("/start", handlerWrapper(startHandler)) http.HandleFunc("/start", handlerWrapper(startHandler))
http.HandleFunc("/about", handlerWrapper(aboutHandler))
// 静态资源 // 静态资源
http.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir("static")))) 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); filter: alpha(opacity=30);
display: none; display: none;
background-color: #000000; background-color: #000000;
z-index: 99;
} }
.dialog-panel { .dialog-panel {
@ -63,11 +64,15 @@
text-align: right; text-align: right;
} }
.dialog-footer button {
margin: 0 5px;
}
#dialogRemoveConfirm, #dialogRemoveConfirm,
.dialog-prompt, .dialog-prompt,
.dialog-form, .dialog-form,
#dialogAlert { #dialogAlert {
padding: 10px 20px 0; padding: 10px 15px 0;
overflow: hidden; overflow: hidden;
} }

View File

@ -20,6 +20,7 @@ var wide = {
$("#dialogAlert").dialog({ $("#dialogAlert").dialog({
"modal": true,
"height": 26, "height": 26,
"width": 260, "width": 260,
"title": config.label.tip, "title": config.label.tip,
@ -31,6 +32,7 @@ var wide = {
}); });
$("#dialogRemoveConfirm").dialog({ $("#dialogRemoveConfirm").dialog({
"modal": true,
"height": 26, "height": 26,
"width": 260, "width": 260,
"title": config.label.delete, "title": config.label.delete,
@ -79,6 +81,7 @@ var wide = {
}); });
$("#dialogNewFilePrompt").dialog({ $("#dialogNewFilePrompt").dialog({
"modal": true,
"height": 52, "height": 52,
"width": 260, "width": 260,
"title": config.label.create_file, "title": config.label.create_file,
@ -152,6 +155,7 @@ var wide = {
}); });
$("#dialogNewDirPrompt").dialog({ $("#dialogNewDirPrompt").dialog({
"modal": true,
"height": 52, "height": 52,
"width": 260, "width": 260,
"title": config.label.create_dir, "title": config.label.create_dir,
@ -191,6 +195,7 @@ var wide = {
}); });
$("#dialogGoLinePrompt").dialog({ $("#dialogGoLinePrompt").dialog({
"modal": true,
"height": 52, "height": 52,
"width": 260, "width": 260,
"title": config.label.goto_line, "title": config.label.goto_line,
@ -229,6 +234,7 @@ var wide = {
}); });
$("#dialogSearchForm").dialog({ $("#dialogSearchForm").dialog({
"modal": true,
"height": 62, "height": 62,
"width": 260, "width": 260,
"title": config.label.search, "title": config.label.search,
@ -614,6 +620,9 @@ var wide = {
wide._save(); wide._save();
break; 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()"> <li onclick="editors.openStartPage()">
<span>{{.i18n.start_page}}</span> <span>{{.i18n.start_page}}</span>
</li> </li>
<li onclick="window.open('/doc/{{.locale}}/index.html')"> <li onclick="wide.openAbout()">
<span>{{.i18n.about}}</span> <span>{{.i18n.about}}</span>
</li> </li>
</ul> </ul>