This commit is contained in:
Liang Ding 2014-11-02 10:39:33 +08:00
parent c4ce4b6f7f
commit bb58dad40c
11 changed files with 30 additions and 43 deletions

View File

@ -13,7 +13,6 @@ import (
"time" "time"
"github.com/b3log/wide/event" "github.com/b3log/wide/event"
_ "github.com/b3log/wide/i18n"
"github.com/b3log/wide/util" "github.com/b3log/wide/util"
"github.com/golang/glog" "github.com/golang/glog"
) )
@ -42,13 +41,16 @@ type User struct {
Workspace string // the GOPATH of this user Workspace string // the GOPATH of this user
Locale string Locale string
GoFormat string GoFormat string
Editor editor FontFamily string
FontSize string
Editor *Editor
LatestSessionContent *LatestSessionContent LatestSessionContent *LatestSessionContent
} }
// Editor configuration of a user. // Editor configuration of a user.
type editor struct { type Editor struct {
FontSize string FontFamily string
FontSize string
} }
// Configuration. // Configuration.
@ -309,12 +311,9 @@ func UpdateCustomizedConf(username string) {
return return
} }
editor := u.Editor model := map[string]interface{}{"user": u}
model := map[string]interface{}{"font_family": "Helvetica, 'Microsoft Yahei'", "font_size": editor.FontSize}
t, err := template.ParseFiles("static/user/style.css.tmpl") t, err := template.ParseFiles("static/user/style.css.tmpl")
if nil != err { if nil != err {
glog.Error(err) glog.Error(err)

View File

@ -19,8 +19,11 @@
"Workspace": "{pwd}/data/user_workspaces/admin", "Workspace": "{pwd}/data/user_workspaces/admin",
"Locale": "en_US", "Locale": "en_US",
"GoFormat": "gofmt", "GoFormat": "gofmt",
"FontFamily": "Helvetica",
"FontSize": "inherit",
"Editor": { "Editor": {
"FontSize": "9" "FontFamily": "Consolas, 'Courier New', monospace",
"FontSize": "inherit"
}, },
"LatestSessionContent": { "LatestSessionContent": {
"FileTree": [], "FileTree": [],

View File

@ -28,6 +28,8 @@ func init() {
flag.Set("v", "3") flag.Set("v", "3")
flag.Parse() flag.Parse()
i18n.Load()
event.Load() event.Load()
conf.Load() conf.Load()

View File

@ -156,7 +156,7 @@ func addUser(username, password string) string {
workspace := filepath.Join(dir, username) workspace := filepath.Join(dir, username)
newUser := &conf.User{Name: username, Password: password, Workspace: workspace, newUser := &conf.User{Name: username, Password: password, Workspace: workspace,
Locale: conf.Wide.Locale, GoFormat: "gofmt"} Locale: conf.Wide.Locale, GoFormat: "gofmt", Editor: &conf.Editor{FontSize: "10px"}}
conf.Wide.Users = append(conf.Wide.Users, newUser) conf.Wide.Users = append(conf.Wide.Users, newUser)
if !conf.Save() { if !conf.Save() {

View File

@ -1,8 +0,0 @@
body {
font-family: Helvetica, 'MS Gothic';
}
input,
button {
font-family: Helvetica, 'MS Gothic';
}

View File

@ -1,8 +0,0 @@
body {
font-family: Helvetica, 'Microsoft Yahei';
}
input,
button {
font-family: Helvetica, 'Microsoft Yahei';
}

View File

@ -222,7 +222,6 @@
background: white; background: white;
font-size: 90%; font-size: 90%;
font-family: Consolas, Courier New, monospace;
max-height: 20em; max-height: 20em;
overflow-y: auto; overflow-y: auto;
@ -230,7 +229,6 @@
.CodeMirror, .CodeMirror,
.CodeMirror-hints { .CodeMirror-hints {
font-family: Consolas, Courier New, monospace;
} }
.CodeMirror-focused .cm-matchhighlight { .CodeMirror-focused .cm-matchhighlight {

View File

@ -1,12 +1,12 @@
body { body,
font-family: Helvetica, 'Microsoft Yahei';
}
input, input,
button { button {
font-family: Helvetica, 'Microsoft Yahei'; font-family: Helvetica;
} }
.edit-exprinfo, .CodeMirror, .CodeMirror-hints { .edit-exprinfo,
font-size: ; .CodeMirror,
.CodeMirror-hints {
font-family: Consolas, 'Courier New', monospace;
font-size: inherit;
} }

View File

@ -1,12 +1,12 @@
body { body,
font-family: {{.font_family}};
}
input, input,
button { button {
font-family: {{.font_family}}; font-family: {{.user.FontFamily}};
} }
.edit-exprinfo, .CodeMirror, .CodeMirror-hints { .edit-exprinfo,
font-size: {{.font_size}}; .CodeMirror,
.CodeMirror-hints {
font-family: {{.user.Editor.FontFamily}};
font-size: {{.user.Editor.FontSize}};
} }

View File

@ -14,12 +14,13 @@
<link rel="stylesheet" href="{{.conf.StaticServer}}/static/css/dialog.css?{{.conf.StaticResourceVersion}}"> <link rel="stylesheet" href="{{.conf.StaticServer}}/static/css/dialog.css?{{.conf.StaticResourceVersion}}">
<link rel="stylesheet" href="{{.conf.StaticServer}}/static/css/base.css?{{.conf.StaticResourceVersion}}"> <link rel="stylesheet" href="{{.conf.StaticServer}}/static/css/base.css?{{.conf.StaticResourceVersion}}">
<link rel="stylesheet" href="{{.conf.StaticServer}}/static/css/base-{{.conf.Locale}}.css?{{.conf.StaticResourceVersion}}">
<link rel="stylesheet" href="{{.conf.StaticServer}}/static/css/wide.css?{{.conf.StaticResourceVersion}}"> <link rel="stylesheet" href="{{.conf.StaticServer}}/static/css/wide.css?{{.conf.StaticResourceVersion}}">
<link rel="stylesheet" href="{{.conf.StaticServer}}/static/css/side.css?{{.conf.StaticResourceVersion}}"> <link rel="stylesheet" href="{{.conf.StaticServer}}/static/css/side.css?{{.conf.StaticResourceVersion}}">
<link rel="stylesheet" href="{{.conf.StaticServer}}/static/css/start.css?{{.conf.StaticResourceVersion}}"> <link rel="stylesheet" href="{{.conf.StaticServer}}/static/css/start.css?{{.conf.StaticResourceVersion}}">
<link rel="stylesheet" href="{{.conf.StaticServer}}/static/css/about.css?{{.conf.StaticResourceVersion}}"> <link rel="stylesheet" href="{{.conf.StaticServer}}/static/css/about.css?{{.conf.StaticResourceVersion}}">
<link rel="stylesheet" href="{{.conf.StaticServer}}/static/user/{{.session.Username}}/style.css?{{.conf.StaticResourceVersion}}">
<link rel="icon" type="image/x-icon" href="/favicon.ico" /> <link rel="icon" type="image/x-icon" href="/favicon.ico" />
</head> </head>
<body> <body>