From 068a069503aec8ea910bb64cea1b653c34120e58 Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Mon, 20 Oct 2014 22:27:19 +0800 Subject: [PATCH] add about & dialog add modal --- conf/wide.json | 13 ++++++++++--- main.go | 20 ++++++++++++++++++++ static/css/about.css | 0 static/css/dialog.css | 7 ++++++- static/js/wide.js | 9 +++++++++ view/about.html | 14 ++++++++++++++ view/index.html | 2 +- 7 files changed, 60 insertions(+), 5 deletions(-) create mode 100644 static/css/about.css create mode 100644 view/about.html diff --git a/conf/wide.json b/conf/wide.json index 66248d9..8199c6a 100644 --- a/conf/wide.json +++ b/conf/wide.json @@ -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" } } ] diff --git a/main.go b/main.go index b18f649..1be85a3 100644 --- a/main.go +++ b/main.go @@ -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")))) diff --git a/static/css/about.css b/static/css/about.css new file mode 100644 index 0000000..e69de29 diff --git a/static/css/dialog.css b/static/css/dialog.css index fe44bda..ae5297f 100644 --- a/static/css/dialog.css +++ b/static/css/dialog.css @@ -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; } diff --git a/static/js/wide.js b/static/js/wide.js index 1c90909..482e72e 100644 --- a/static/js/wide.js +++ b/static/js/wide.js @@ -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 () { + } }; diff --git a/view/about.html b/view/about.html new file mode 100644 index 0000000..21f6599 --- /dev/null +++ b/view/about.html @@ -0,0 +1,14 @@ + + + + + {{.i18n.wide}} - {{.i18n.about}} + + + + + + about + + + diff --git a/view/index.html b/view/index.html index 62c431c..971c12d 100644 --- a/view/index.html +++ b/view/index.html @@ -83,7 +83,7 @@
  • {{.i18n.start_page}}
  • -
  • +
  • {{.i18n.about}}