From d74a53b6c83dfe94ebfc65fb3aaaa6cd8843a8c7 Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Sun, 16 Nov 2014 20:45:12 +0800 Subject: [PATCH] #143 --- i18n/en_US.json | 10 ++++++- i18n/ja_JP.json | 10 ++++++- i18n/zh_CN.json | 10 ++++++- i18n/zh_TW.json | 10 ++++++- main.go | 7 ++--- static/js/wide.js | 24 ++++++++++++++-- views/index.html | 6 ++-- views/preference.html | 67 ++++++++++++++++++++++++++++++++++++++++++- 8 files changed, 129 insertions(+), 15 deletions(-) diff --git a/i18n/en_US.json b/i18n/en_US.json index 5f88168..cd851e2 100644 --- a/i18n/en_US.json +++ b/i18n/en_US.json @@ -123,5 +123,13 @@ "close": "Close", "close_other": "Close Other", "clear": "Clear", - "perference": "Perference" + "perference": "Perference", + "appearence": "Appearence", + "gotool": "Go Tool", + "user": "User", + "font": "Font", + "font_size": "Font Size", + "line_height": "Line Height", + "go_format": "Go Format", + "locale": "Locale" } \ No newline at end of file diff --git a/i18n/ja_JP.json b/i18n/ja_JP.json index f86b1dc..99bbe9c 100644 --- a/i18n/ja_JP.json +++ b/i18n/ja_JP.json @@ -123,5 +123,13 @@ "close": "クローズ", "close_other": "閉じるその他", "clear": "空の", - "perference": "偏好设定" + "perference": "偏好设定", + "appearence": "エクステリア", + "gotool": "Go ツール", + "user": "ユーザー", + "font": "フォント", + "font_size": "フォント·サイズ", + "line_height": "行の高さ", + "go_format": "Go フォーマット", + "locale": "ロケール" } diff --git a/i18n/zh_CN.json b/i18n/zh_CN.json index 140baa5..8fa1b59 100644 --- a/i18n/zh_CN.json +++ b/i18n/zh_CN.json @@ -123,5 +123,13 @@ "close": "关闭", "close_other": "关闭其它", "clear": "清空", - "perference": "偏好设定" + "perference": "偏好设定", + "appearence": "外观", + "gotool": "Go 工具", + "user": "用户", + "font": "字体", + "font_size": "字体大小", + "line_height": "行高", + "go_format": "Go 格式化", + "locale": "语言环境" } \ No newline at end of file diff --git a/i18n/zh_TW.json b/i18n/zh_TW.json index 83006a6..e97121b 100644 --- a/i18n/zh_TW.json +++ b/i18n/zh_TW.json @@ -123,5 +123,13 @@ "close": "關閉", "close_other": "關閉其它", "clear": "清空", - "perference": "偏好設定" + "perference": "偏好設定", + "appearence": "外觀", + "gotool": "Go 工具", + "user": "用戶", + "font": "字形", + "font_size": "字體大小", + "line_height": "行高", + "go_format": "Go 格式化", + "locale": "語言環境" } \ No newline at end of file diff --git a/main.go b/main.go index bea0738..c43c37a 100644 --- a/main.go +++ b/main.go @@ -86,10 +86,9 @@ func indexHandler(w http.ResponseWriter, r *http.Request) { locale := user.Locale wideSessions := session.WideSessions.GetByUsername(username) - userConf := conf.Wide.GetUser(username) model := map[string]interface{}{"conf": conf.Wide, "i18n": i18n.GetAll(locale), "locale": locale, - "session": wideSession, "latestSessionContent": userConf.LatestSessionContent, + "session": wideSession, "latestSessionContent": user.LatestSessionContent, "pathSeparator": conf.PathSeparator, "codeMirrorVer": conf.CodeMirrorVer} glog.V(3).Infof("User [%s] has [%d] sessions", username, len(wideSessions)) @@ -226,9 +225,9 @@ func preferenceHandler(w http.ResponseWriter, r *http.Request) { httpSession.Save(r, w) username := httpSession.Values["username"].(string) - locale := conf.Wide.GetUser(username).Locale + user := conf.Wide.GetUser(username) - model := map[string]interface{}{"conf": conf.Wide, "i18n": i18n.GetAll(locale), "locale": locale, + model := map[string]interface{}{"conf": conf.Wide, "i18n": i18n.GetAll(user.Locale), "user": user, "ver": conf.WideVersion, "goos": runtime.GOOS, "goarch": runtime.GOARCH, "gover": runtime.Version()} t, err := template.ParseFiles("views/preference.html") diff --git a/static/js/wide.js b/static/js/wide.js index 32ebc05..9b6b6af 100644 --- a/static/js/wide.js +++ b/static/js/wide.js @@ -451,8 +451,8 @@ var wide = { }); }); }, - openPreference:function () { - $("#dialogPreference").dialog("open"); + openPreference: function () { + $("#dialogPreference").dialog("open"); }, _initPreference: function () { $("#dialogPreference").load('/preference', function () { @@ -461,7 +461,23 @@ var wide = { "height": 460, "width": 800, "title": config.label.perference, - "hideFooter": true + "ok": function () { + var request = newWideRequest(); + request.executable = data.executable; + + $.ajax({ + type: 'POST', + url: '/preference', + data: JSON.stringify(request), + success: function (data, textStatus, jqXHR) { + + } + }); + } + }); + + new Tabs({ + id: ".preference" }); }); }, @@ -598,6 +614,8 @@ var wide = { this._initLayout(); + this._initPreference(); + $(window).resize(function () { wide._initLayout(); var editorDatas = editors.data, diff --git a/views/index.html b/views/index.html index 2fcbaf4..0a60e90 100644 --- a/views/index.html +++ b/views/index.html @@ -37,9 +37,6 @@
  • {{.i18n.close_all_files}}
  • -
  • - {{.i18n.perference}} -
  • {{.i18n.exit}} @@ -93,6 +90,9 @@
  • +
  • + {{.i18n.perference}} +
  • {{.i18n.help}}
    diff --git a/views/preference.html b/views/preference.html index 167d16b..4a608c1 100644 --- a/views/preference.html +++ b/views/preference.html @@ -1 +1,66 @@ -perference \ No newline at end of file +
    +
    +
    + {{.i18n.appearence}} +
    +
    + {{.i18n.editor}} +
    +
    + {{.i18n.gotool}} +
    +
    + {{.i18n.user}} +
    +
    +
    +
    + + + +
    +
    + + +
    +
    + +
    +
    + + + + +
    +
    +
    \ No newline at end of file