This commit is contained in:
Liang Ding 2014-11-16 20:45:12 +08:00
parent f83ec4faaa
commit d74a53b6c8
8 changed files with 129 additions and 15 deletions

View File

@ -123,5 +123,13 @@
"close": "Close", "close": "Close",
"close_other": "Close Other", "close_other": "Close Other",
"clear": "Clear", "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"
} }

View File

@ -123,5 +123,13 @@
"close": "クローズ", "close": "クローズ",
"close_other": "閉じるその他", "close_other": "閉じるその他",
"clear": "空の", "clear": "空の",
"perference": "偏好设定" "perference": "偏好设定",
"appearence": "エクステリア",
"gotool": "Go ツール",
"user": "ユーザー",
"font": "フォント",
"font_size": "フォント·サイズ",
"line_height": "行の高さ",
"go_format": "Go フォーマット",
"locale": "ロケール"
} }

View File

@ -123,5 +123,13 @@
"close": "关闭", "close": "关闭",
"close_other": "关闭其它", "close_other": "关闭其它",
"clear": "清空", "clear": "清空",
"perference": "偏好设定" "perference": "偏好设定",
"appearence": "外观",
"gotool": "Go 工具",
"user": "用户",
"font": "字体",
"font_size": "字体大小",
"line_height": "行高",
"go_format": "Go 格式化",
"locale": "语言环境"
} }

View File

@ -123,5 +123,13 @@
"close": "關閉", "close": "關閉",
"close_other": "關閉其它", "close_other": "關閉其它",
"clear": "清空", "clear": "清空",
"perference": "偏好設定" "perference": "偏好設定",
"appearence": "外觀",
"gotool": "Go 工具",
"user": "用戶",
"font": "字形",
"font_size": "字體大小",
"line_height": "行高",
"go_format": "Go 格式化",
"locale": "語言環境"
} }

View File

@ -86,10 +86,9 @@ func indexHandler(w http.ResponseWriter, r *http.Request) {
locale := user.Locale locale := user.Locale
wideSessions := session.WideSessions.GetByUsername(username) wideSessions := session.WideSessions.GetByUsername(username)
userConf := 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(locale), "locale": locale,
"session": wideSession, "latestSessionContent": userConf.LatestSessionContent, "session": wideSession, "latestSessionContent": user.LatestSessionContent,
"pathSeparator": conf.PathSeparator, "codeMirrorVer": conf.CodeMirrorVer} "pathSeparator": conf.PathSeparator, "codeMirrorVer": conf.CodeMirrorVer}
glog.V(3).Infof("User [%s] has [%d] sessions", username, len(wideSessions)) 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) httpSession.Save(r, w)
username := httpSession.Values["username"].(string) 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()} "ver": conf.WideVersion, "goos": runtime.GOOS, "goarch": runtime.GOARCH, "gover": runtime.Version()}
t, err := template.ParseFiles("views/preference.html") t, err := template.ParseFiles("views/preference.html")

View File

@ -461,7 +461,23 @@ var wide = {
"height": 460, "height": 460,
"width": 800, "width": 800,
"title": config.label.perference, "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._initLayout();
this._initPreference();
$(window).resize(function () { $(window).resize(function () {
wide._initLayout(); wide._initLayout();
var editorDatas = editors.data, var editorDatas = editors.data,

View File

@ -37,9 +37,6 @@
<li class="close-all" onclick="wide.closeAllFiles()"> <li class="close-all" onclick="wide.closeAllFiles()">
<span>{{.i18n.close_all_files}}</span> <span>{{.i18n.close_all_files}}</span>
</li> </li>
<li class="close-all" onclick="wide.openPreference()">
<span>{{.i18n.perference}}</span>
</li>
<li class="hr"></li> <li class="hr"></li>
<li onclick="wide.exit()"> <li onclick="wide.exit()">
<span>{{.i18n.exit}}</span> <span>{{.i18n.exit}}</span>
@ -93,6 +90,9 @@
</ul> </ul>
</div> </div>
</li> </li>
<li onclick="wide.openPreference()">
<span>{{.i18n.perference}}</span>
</li>
<li> <li>
<span>{{.i18n.help}}</span> <span>{{.i18n.help}}</span>
<div class="frame"> <div class="frame">

View File

@ -1 +1,66 @@
perference <div class="preference">
<div class="tabs">
<div class="current" data-index="appearence">
<span title="{{.i18n.appearence}}">{{.i18n.appearence}}</span>
</div>
<div data-index="editor">
<span title="{{.i18n.editor}}">{{.i18n.editor}}</span>
</div>
<div data-index="gotool">
<span title="{{.i18n.gotool}}">{{.i18n.gotool}}</span>
</div>
<div data-index="user">
<span title="{{.i18n.user}}">{{.i18n.user}}</span>
</div>
</div>
<div class="tabs-panel">
<div data-index="appearence">
<label>
{{.i18n.font}}{{.i18n.colon}}
<input value="{{.user.FontFamily}}" name="fontFamily"/>
</label>
<label>
{{.i18n.font_size}}{{.i18n.colon}}
<input value="{{.user.FontSize}}" name="fontSize"/>
</label>
<label>
{{.i18n.line_height}}{{.i18n.colon}}
<input value="{{.user.Editor.LineHeight}}" name="lineHeight"/>
</label>
</div>
<div class="fn-none" data-index="editor">
<label>
{{.i18n.font}}{{.i18n.colon}}
<input value="{{.user.Editor.FontFamily}}" name="editorFontFamily"/>
</label>
<label>
{{.i18n.font_size}}{{.i18n.colon}}
<input value="{{.user.Editor.FontSize}}" name="editorFontSize"/>
</label>
</div>
<div class="fn-none" data-index="gotool">
<label>
{{.i18n.go_format}}{{.i18n.colon}}
<input value="{{.user.GoFormat}}" name="goFormat"/>
</label>
</div>
<div class="fn-none" data-index="user">
<label>
{{.i18n.locale}}{{.i18n.colon}}
<input value="{{.user.Locale}}" name="locale"/>
</label>
<label>
{{.i18n.workspace}}{{.i18n.colon}}
<input value="{{.user.Workspace}}" name="workspace"/>
</label>
<label>
{{.i18n.username}}{{.i18n.colon}}
<input value="{{.user.Name}}" name="username"/>
</label>
<label>
{{.i18n.password}}{{.i18n.colon}}
<input value="{{.user.Password}}" name="password"/>
</label>
</div>
</div>
</div>