From 6ce9d800d014f5d440271e628c538ce823bbe263 Mon Sep 17 00:00:00 2001 From: Unknown Date: Mon, 10 Mar 2014 23:03:17 -0400 Subject: [PATCH 1/3] Add custom.ini --- .gitignore | 3 ++- conf/app.ini | 2 -- models/models.go | 15 +-------------- modules/base/conf.go | 12 +++++++++++- 4 files changed, 14 insertions(+), 18 deletions(-) diff --git a/.gitignore b/.gitignore index b0f80a578465..49d19b83d0aa 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ gogs *.exe~ .DS_Store *.db -*.log \ No newline at end of file +*.log +conf/custom.ini \ No newline at end of file diff --git a/conf/app.ini b/conf/app.ini index 1969dcba1c3e..fb425d81c095 100644 --- a/conf/app.ini +++ b/conf/app.ini @@ -3,7 +3,6 @@ RUN_USER = lunny [repository] ROOT = /Users/lunny/git/gogs-repositories -ROOT_jiahuachen = /Users/jiahuachen/git/gogs-repositories [server] HTTP_ADDR = @@ -15,7 +14,6 @@ HOST = NAME = gogs USER = root PASSWD = -PASSWD_jiahua = root [security] USER_PASSWD_SALT = !#@FDEWREWR&*( diff --git a/models/models.go b/models/models.go index 7dfc0aaf0a82..056682475909 100644 --- a/models/models.go +++ b/models/models.go @@ -7,7 +7,6 @@ package models import ( "fmt" "os" - "os/user" _ "github.com/go-sql-driver/mysql" "github.com/lunny/xorm" @@ -47,16 +46,7 @@ func setEngine() { dbUser := base.Cfg.MustValue("database", "USER") dbPwd := base.Cfg.MustValue("database", "PASSWD") - uname, err := user.Current() - if err != nil { - fmt.Printf("models.init -> fail to get user: %s\n", err) - os.Exit(2) - } - - if uname.Username == "jiahuachen" { - dbPwd = base.Cfg.MustValue("database", "PASSWD_jiahua") - } - + var err error switch dbType { case "mysql": orm, err = xorm.NewEngine("mysql", fmt.Sprintf("%v:%v@%v/%v?charset=utf8", @@ -83,9 +73,6 @@ func setEngine() { //log.Trace("Initialized database -> %s", dbName) RepoRootPath = base.Cfg.MustValue("repository", "ROOT") - if uname.Username == "jiahuachen" { - RepoRootPath = base.Cfg.MustValue("repository", "ROOT_jiahuachen") - } } func init() { diff --git a/modules/base/conf.go b/modules/base/conf.go index 19e9d689c2ba..1240448c10a2 100644 --- a/modules/base/conf.go +++ b/modules/base/conf.go @@ -11,6 +11,7 @@ import ( "path" "path/filepath" + "github.com/Unknwon/com" "github.com/Unknwon/goconfig" ) @@ -36,11 +37,20 @@ func init() { os.Exit(2) } - cfgPath := filepath.Join(workDir, "conf", "app.ini") + cfgPathPrefix := filepath.Join(workDir, "conf") + cfgPath := filepath.Join(cfgPathPrefix, "app.ini") Cfg, err = goconfig.LoadConfigFile(cfgPath) if err != nil { fmt.Printf("Cannot load config file '%s'\n", cfgPath) os.Exit(2) } + + cfgPath = filepath.Join(cfgPathPrefix, "custom.ini") + if com.IsFile(cfgPath) { + if err = Cfg.AppendFiles(cfgPath); err != nil { + fmt.Printf("Cannot load config file '%s'\n", cfgPath) + os.Exit(2) + } + } Cfg.BlockMode = false } From 7f92579905c1bd596d547c8a423e043465f055d7 Mon Sep 17 00:00:00 2001 From: FuXiaoHei Date: Tue, 11 Mar 2014 11:41:38 +0800 Subject: [PATCH 2/3] finish user delete page ui --- public/css/gogs.css | 10 +++++----- public/js/app.js | 2 +- routers/user/setting.go | 1 + routers/user/user.go | 2 +- templates/user/delete.tmpl | 35 ++++++++++++++++++++++++++++------- templates/user/publickey.tmpl | 2 +- templates/user/setting.tmpl | 2 +- 7 files changed, 38 insertions(+), 16 deletions(-) diff --git a/public/css/gogs.css b/public/css/gogs.css index 4a4144babde4..05e308105153 100755 --- a/public/css/gogs.css +++ b/public/css/gogs.css @@ -32,7 +32,7 @@ body { background-color: transparent; } -.btn{ +.btn { cursor: pointer; } @@ -234,7 +234,7 @@ body { /* gogits user setting */ -#gogs-user-setting-nav > h4, #gogs-user-setting-container > h4 ,#gogs-ssh-keys > h4{ +#gogs-user-setting-nav > h4, #gogs-user-setting-container > h4, #gogs-ssh-keys > h4, #gogs-user-delete > h4 { padding-bottom: 18px; margin-bottom: 18px; border-bottom: 1px solid #CCC; @@ -263,11 +263,11 @@ body { border-bottom: 1px solid #DDD; } -#gogs-ssh-keys .list-group-item:after{ +#gogs-ssh-keys .list-group-item:after { clear: both; } -#gogs-ssh-keys .list-group-item:hover a.delete{ +#gogs-ssh-keys .list-group-item:hover a.delete { display: block; } @@ -298,6 +298,6 @@ body { border-radius: 3px; } -#gogs-ssh-form textarea{ +#gogs-ssh-form textarea { height: 16em; } \ No newline at end of file diff --git a/public/js/app.js b/public/js/app.js index f6e14712040c..a789122b1bf5 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -104,7 +104,7 @@ function initUserSetting(){ var $this = $(this); Gogits.ajaxDelete("",{"id":$this.data("del")},function(json){ if(json.ok){ - $this.parent().remove(); + window.location.reload(); }else{ alert(json.err); } diff --git a/routers/user/setting.go b/routers/user/setting.go index 96a02b6f46d9..0669784be0a3 100644 --- a/routers/user/setting.go +++ b/routers/user/setting.go @@ -56,6 +56,7 @@ func SettingSSHKeys(form auth.AddSSHKeyForm, r render.Render, data base.TmplData "ok": true, }) } + return } // Add new SSH key. diff --git a/routers/user/user.go b/routers/user/user.go index 51a84400abdb..ca9dddaecdf2 100644 --- a/routers/user/user.go +++ b/routers/user/user.go @@ -134,7 +134,7 @@ func SignUp(form auth.RegisterForm, data base.TmplData, req *http.Request, r ren // TODO: unfinished func Delete(data base.TmplData, req *http.Request, r render.Render) { - data["Title"] = "Delete user" + data["Title"] = "Delete Account" if req.Method == "GET" { r.HTML(200, "user/delete", data) diff --git a/templates/user/delete.tmpl b/templates/user/delete.tmpl index 939048b42121..7a9dcddfe6de 100644 --- a/templates/user/delete.tmpl +++ b/templates/user/delete.tmpl @@ -1,12 +1,33 @@ {{template "base/head" .}} {{template "base/navbar" .}} +
+ +
+
+

Delete Account

+

Deleting your account is permanent. Sorry to see you go, if you have any feedback you can contact us.

+
+
+ +
+
+
+
+
+{{template "base/footer" .}} +{{template "base/head" .}} +{{template "base/navbar" .}}
-
-
-
- -
-
-
+
{{template "base/footer" .}} \ No newline at end of file diff --git a/templates/user/publickey.tmpl b/templates/user/publickey.tmpl index 7510616d8652..0bd76593e7fe 100644 --- a/templates/user/publickey.tmpl +++ b/templates/user/publickey.tmpl @@ -9,7 +9,7 @@
  • Notifications
  • SSH Keys
  • Security
  • -
  • Kill Myself
  • +
  • Delete Account
  • diff --git a/templates/user/setting.tmpl b/templates/user/setting.tmpl index cc527a25acd9..928d359a26a0 100644 --- a/templates/user/setting.tmpl +++ b/templates/user/setting.tmpl @@ -9,7 +9,7 @@
  • Notifications
  • SSH Keys
  • Security
  • -
  • Kill Myself
  • +
  • Delete Account
  • From 295cfd42aa7a3248c044abdc530a96b722fb5e6b Mon Sep 17 00:00:00 2001 From: FuXiaoHei Date: Tue, 11 Mar 2014 11:43:25 +0800 Subject: [PATCH 3/3] finish user delete page ui --- templates/user/delete.tmpl | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/templates/user/delete.tmpl b/templates/user/delete.tmpl index 7a9dcddfe6de..e6522aa21d1b 100644 --- a/templates/user/delete.tmpl +++ b/templates/user/delete.tmpl @@ -24,10 +24,11 @@
    -{{template "base/footer" .}} -{{template "base/head" .}} -{{template "base/navbar" .}} -
    - -
    + {{template "base/footer" .}} \ No newline at end of file