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

View File

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

View File

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

View File

@ -156,7 +156,7 @@ func addUser(username, password string) string {
workspace := filepath.Join(dir, username)
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)
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;
font-size: 90%;
font-family: Consolas, Courier New, monospace;
max-height: 20em;
overflow-y: auto;
@ -230,7 +229,6 @@
.CodeMirror,
.CodeMirror-hints {
font-family: Consolas, Courier New, monospace;
}
.CodeMirror-focused .cm-matchhighlight {

View File

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

View File

@ -1,12 +1,12 @@
body {
font-family: {{.font_family}};
}
body,
input,
button {
font-family: {{.font_family}};
font-family: {{.user.FontFamily}};
}
.edit-exprinfo, .CodeMirror, .CodeMirror-hints {
font-size: {{.font_size}};
.edit-exprinfo,
.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/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/side.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/user/{{.session.Username}}/style.css?{{.conf.StaticResourceVersion}}">
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
</head>
<body>