From 8ef71343dfef8914e9383e159915baa6a341eeef Mon Sep 17 00:00:00 2001 From: slene Date: Thu, 20 Mar 2014 17:25:04 +0800 Subject: [PATCH 01/41] fix link --- routers/repo/single.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/routers/repo/single.go b/routers/repo/single.go index c10d30a7d6..2bc77c1c01 100644 --- a/routers/repo/single.go +++ b/routers/repo/single.go @@ -137,10 +137,9 @@ func Single(ctx *middleware.Context, params martini.Params) { return } else { // current repo branch link - urlPrefix := "http://" + base.Domain + branchLink ctx.Data["FileName"] = readmeFile.Name - ctx.Data["FileContent"] = string(base.RenderMarkdown(blob.Contents(), urlPrefix)) + ctx.Data["FileContent"] = string(base.RenderMarkdown(blob.Contents(), branchLink)) } } } From c3532718a79f102f4e19c11868a2c618b482eb6a Mon Sep 17 00:00:00 2001 From: slene Date: Thu, 20 Mar 2014 17:25:48 +0800 Subject: [PATCH 02/41] add anchor --- public/css/markdown.css | 59 ++++++++++++++++++++++++++++++++++++++--- public/js/app.js | 21 ++++++++++++++- 2 files changed, 76 insertions(+), 4 deletions(-) diff --git a/public/css/markdown.css b/public/css/markdown.css index 9283fb847c..1edc3b626c 100644 --- a/public/css/markdown.css +++ b/public/css/markdown.css @@ -15,7 +15,8 @@ line-height: 1.7; padding: 15px 0 0; margin: 0 0 15px; - color: #666; + color: #444; + font-weight: bold; } .markdown h1, @@ -86,6 +87,10 @@ margin-top: 6px; } +.markdown li:first-child { + margin-top: 0; +} + .markdown dl dt { font-style: italic; margin-top: 9px; @@ -130,11 +135,11 @@ } .markdown > pre > ol.linenums > li:first-child { - padding-top: 6px; + padding-top: 12px; } .markdown > pre > ol.linenums > li:last-child { - padding-bottom: 6px; + padding-bottom: 12px; } .markdown > pre > ol.linenums > li { @@ -163,6 +168,54 @@ color: #fff; } +.markdown .anchor-wrap { + /*margin-top: -50px;*/ + /*padding-top: 50px;*/ +} + +.markdown h1 a, .markdown h2 a, .markdown h3 a { + text-decoration: none; +} + +.markdown h1 a.anchor, +.markdown h2 a.anchor, +.markdown h3 a.anchor, +.markdown h4 a.anchor, +.markdown h5 a.anchor, +.markdown h6 a.anchor { + text-decoration:none; + line-height:1; + padding-left:0; + margin-left:5px; + top:15%; +} +.markdown a span.octicon { + font-size: 16px; + font-family: "FontAwesome"; + line-height: 1; + display: inline-block; + text-decoration: none; + -webkit-font-smoothing: antialiased; +} + +.markdown a span.octicon-link { + display: none; + color: #000; +} + +.markdown a span.octicon-link:before { + content: "\f0c1"; +} + +.markdown h1:hover .octicon-link, +.markdown h2:hover .octicon-link, +.markdown h3:hover .octicon-link, +.markdown h4:hover .octicon-link, +.markdown h5:hover .octicon-link, +.markdown h6:hover .octicon-link { + display:inline-block +} + /* Author: jmblog */ /* Project: https://github.com/jmblog/color-themes-for-google-code-prettify */ /* GitHub Theme */ diff --git a/public/js/app.js b/public/js/app.js index 30296bc337..f3e8d6d1d2 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -66,9 +66,28 @@ var Gogits = { // render markdown Gogits.renderMarkdown = function () { - var $pre = $('.markdown').find('pre > code').parent(); + var $md = $('.markdown'); + var $pre = $md.find('pre > code').parent(); $pre.addClass("prettyprint"); prettyPrint(); + + // Set anchor. + var headers = {}; + $md.find('h1, h2, h3, h4, h5, h6').each(function () { + var node = $(this); + var val = encodeURIComponent(node.text().toLowerCase().replace(/[^\w\- ]/g, '').replace(/[ ]/g, '-')); + var name = val; + if(headers[val] > 0){ + name = val + '-' + headers[val]; + } + if(headers[val] == undefined){ + headers[val] = 1; + }else{ + headers[val] += 1; + } + node = node.wrap('
'); + node.append(''); + }); } })(jQuery); From 21379e30a18fed473ae2bbeb41332919ff80497d Mon Sep 17 00:00:00 2001 From: slene Date: Thu, 20 Mar 2014 17:31:18 +0800 Subject: [PATCH 03/41] fix link --- modules/base/markdown.go | 4 ++-- public/css/gogs.css | 8 ++++++++ templates/repo/single_file.tmpl | 10 +++++++--- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/modules/base/markdown.go b/modules/base/markdown.go index a9f4cbf0d7..e49e111c0e 100644 --- a/modules/base/markdown.go +++ b/modules/base/markdown.go @@ -36,7 +36,7 @@ func isLink(link []byte) bool { func IsMarkdownFile(name string) bool { name = strings.ToLower(name) switch filepath.Ext(name) { - case "md", "markdown": + case "md", "markdown", "mdown": return true } return false @@ -61,7 +61,7 @@ type CustomRender struct { func (options *CustomRender) Link(out *bytes.Buffer, link []byte, title []byte, content []byte) { if len(link) > 0 && !isLink(link) { if link[0] == '#' { - link = append([]byte(options.urlPrefix), link...) + // link = append([]byte(options.urlPrefix), link...) } else { link = []byte(path.Join(options.urlPrefix, string(link))) } diff --git a/public/css/gogs.css b/public/css/gogs.css index a4767c1c8b..83d1b96fe2 100755 --- a/public/css/gogs.css +++ b/public/css/gogs.css @@ -647,6 +647,14 @@ html, body { padding: 30px 30px 50px; } +.file-content .file-body.file-code { + padding: 0; +} + +.file-content .file-body.file-code > pre { + border: none; +} + .branch-list th, .commit-list th { background-color: #FFF; line-height: 28px !important; diff --git a/templates/repo/single_file.tmpl b/templates/repo/single_file.tmpl index b4626053fd..0c1c3713f6 100644 --- a/templates/repo/single_file.tmpl +++ b/templates/repo/single_file.tmpl @@ -1,6 +1,10 @@
- {{.FileName}} + {{if .ReadmeExist}} + + {{else}} + + {{end}}{{.FileName}}
{{if .FileIsLarge}} {{else}} -
-
{{.FileContent}}
+
+
{{.FileContent}}
{{end}} {{end}} From 9f9cd6bfc61d82ee0a3d31cee112be7975b8ca86 Mon Sep 17 00:00:00 2001 From: Unknown Date: Thu, 20 Mar 2014 07:50:26 -0400 Subject: [PATCH 04/41] Work on admin --- .gitignore | 4 +++- conf/app.ini | 4 ++++ models/user.go | 1 + modules/base/conf.go | 2 ++ modules/middleware/auth.go | 14 +++++++++++++- modules/middleware/context.go | 16 +++++++++++++--- routers/admin/admin.go | 24 ++++++++++++++++++++++++ routers/dashboard.go | 4 ++-- routers/dev/template.go | 2 +- routers/repo/repo.go | 4 ++-- routers/repo/single.go | 16 ++++++++-------- routers/user/setting.go | 18 +++++++++--------- routers/user/user.go | 28 ++++++++++++++-------------- templates/admin/dashboard.tmpl | 24 ++++++++++++++++++++++++ templates/admin/repos.tmpl | 23 +++++++++++++++++++++++ templates/admin/users.tmpl | 23 +++++++++++++++++++++++ templates/base/navbar.tmpl | 1 + templates/repo/setting.tmpl | 4 ++++ web.go | 6 ++++++ 19 files changed, 177 insertions(+), 41 deletions(-) create mode 100644 routers/admin/admin.go create mode 100644 templates/admin/dashboard.tmpl create mode 100644 templates/admin/repos.tmpl create mode 100644 templates/admin/users.tmpl diff --git a/.gitignore b/.gitignore index 3e550c3fc7..ad27cc8be8 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,6 @@ gogs *.db *.log custom/ -.vendor/ \ No newline at end of file +.vendor/ +.idea/ +*.iml \ No newline at end of file diff --git a/conf/app.ini b/conf/app.ini index 658f7c0151..21090ceba5 100644 --- a/conf/app.ini +++ b/conf/app.ini @@ -27,6 +27,10 @@ PASSWD = ; For "postgres" only, either "disable", "require" or "verify-full" SSL_MODE = disable +[admin] +; Administor's name, which should be same as the user name you want to authorize +NAME = admin + [security] ; !!CHANGE THIS TO KEEP YOUR USER DATA SAFE!! SECRET_KEY = !#@FDEWREWR&*( diff --git a/models/user.go b/models/user.go index 76cf2d20ce..8f74fd53fb 100644 --- a/models/user.go +++ b/models/user.go @@ -51,6 +51,7 @@ type User struct { Location string Website string IsActive bool + IsAdmin bool Rands string `xorm:"VARCHAR(10)"` Created time.Time `xorm:"created"` Updated time.Time `xorm:"updated"` diff --git a/modules/base/conf.go b/modules/base/conf.go index fdbf3ad385..c904c5b39c 100644 --- a/modules/base/conf.go +++ b/modules/base/conf.go @@ -32,6 +32,7 @@ var ( AppUrl string Domain string SecretKey string + AdminName string Cfg *goconfig.ConfigFile MailService *Mailer ) @@ -173,6 +174,7 @@ func init() { AppUrl = Cfg.MustValue("server", "ROOT_URL") Domain = Cfg.MustValue("server", "DOMAIN") SecretKey = Cfg.MustValue("security", "SECRET_KEY") + AdminName = strings.ToLower(Cfg.MustValue("admin", "NAME")) } func NewServices() { diff --git a/modules/middleware/auth.go b/modules/middleware/auth.go index d45a21e988..b67f766bd7 100644 --- a/modules/middleware/auth.go +++ b/modules/middleware/auth.go @@ -20,7 +20,7 @@ func SignInRequire(redirect bool) martini.Handler { return } else if !ctx.User.IsActive && base.Service.RegisterEmailConfirm { ctx.Data["Title"] = "Activate Your Account" - ctx.Render.HTML(200, "user/active", ctx.Data) + ctx.HTML(200, "user/active") return } } @@ -31,6 +31,18 @@ func SignOutRequire() martini.Handler { return func(ctx *Context) { if ctx.IsSigned { ctx.Redirect("/") + return } } } + +// AdminRequire requires user signed in as administor. +func AdminRequire() martini.Handler { + return func(ctx *Context) { + if ctx.User.LowerName != base.AdminName && !ctx.User.IsAdmin { + ctx.Error(403) + return + } + ctx.Data["PageIsAdmin"] = true + } +} diff --git a/modules/middleware/context.go b/modules/middleware/context.go index 6ac87de3be..744cdfc10c 100644 --- a/modules/middleware/context.go +++ b/modules/middleware/context.go @@ -14,6 +14,7 @@ import ( "github.com/gogits/gogs/models" "github.com/gogits/gogs/modules/auth" + "github.com/gogits/gogs/modules/base" "github.com/gogits/gogs/modules/log" ) @@ -61,24 +62,29 @@ func (ctx *Context) HasError() bool { return hasErr.(bool) } +// HTML calls render.HTML underlying but reduce one argument. +func (ctx *Context) HTML(status int, name string, htmlOpt ...HTMLOptions) { + ctx.Render.HTML(status, name, ctx.Data, htmlOpt...) +} + // RenderWithErr used for page has form validation but need to prompt error to users. func (ctx *Context) RenderWithErr(msg, tpl string, form auth.Form) { ctx.Data["HasError"] = true ctx.Data["ErrorMsg"] = msg auth.AssignForm(form, ctx.Data) - ctx.HTML(200, tpl, ctx.Data) + ctx.HTML(200, tpl) } // Handle handles and logs error by given status. func (ctx *Context) Handle(status int, title string, err error) { log.Error("%s: %v", title, err) if martini.Dev == martini.Prod { - ctx.HTML(500, "status/500", ctx.Data) + ctx.HTML(500, "status/500") return } ctx.Data["ErrorMsg"] = err - ctx.HTML(status, fmt.Sprintf("status/%d", status), ctx.Data) + ctx.HTML(status, fmt.Sprintf("status/%d", status)) } // InitContext initializes a classic context for a request. @@ -106,6 +112,10 @@ func InitContext() martini.Handler { ctx.Data["SignedUser"] = user ctx.Data["SignedUserId"] = user.Id ctx.Data["SignedUserName"] = user.LowerName + + if ctx.User.IsAdmin || ctx.User.LowerName == base.AdminName { + ctx.Data["IsAdmin"] = true + } } ctx.Data["PageStartTime"] = time.Now() diff --git a/routers/admin/admin.go b/routers/admin/admin.go new file mode 100644 index 0000000000..c7523b7f59 --- /dev/null +++ b/routers/admin/admin.go @@ -0,0 +1,24 @@ +// Copyright 2014 The Gogs Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + +package admin + +import ( + "github.com/gogits/gogs/modules/middleware" +) + +func Dashboard(ctx *middleware.Context) { + ctx.Data["Title"] = "Admin Dashboard" + ctx.HTML(200, "admin/dashboard") +} + +func Users(ctx *middleware.Context) { + ctx.Data["Title"] = "User Management" + ctx.HTML(200, "admin/users") +} + +func Repositories(ctx *middleware.Context) { + ctx.Data["Title"] = "Repository Management" + ctx.HTML(200, "admin/repos") +} diff --git a/routers/dashboard.go b/routers/dashboard.go index 6c194ad9e5..f61d67b7de 100644 --- a/routers/dashboard.go +++ b/routers/dashboard.go @@ -15,10 +15,10 @@ func Home(ctx *middleware.Context) { return } ctx.Data["PageIsHome"] = true - ctx.HTML(200, "home", ctx.Data) + ctx.HTML(200, "home") } func Help(ctx *middleware.Context) { ctx.Data["PageIsHelp"] = true - ctx.HTML(200, "help", ctx.Data) + ctx.HTML(200, "help") } diff --git a/routers/dev/template.go b/routers/dev/template.go index 7d5225ece7..d2f77ac4d5 100644 --- a/routers/dev/template.go +++ b/routers/dev/template.go @@ -21,5 +21,5 @@ func TemplatePreview(ctx *middleware.Context, params martini.Params) { ctx.Data["Code"] = "2014031910370000009fff6782aadb2162b4a997acb69d4400888e0b9274657374" ctx.Data["ActiveCodeLives"] = base.Service.ActiveCodeLives / 60 ctx.Data["ResetPwdCodeLives"] = base.Service.ResetPwdCodeLives / 60 - ctx.HTML(200, params["_1"], ctx.Data) + ctx.HTML(200, params["_1"]) } diff --git a/routers/repo/repo.go b/routers/repo/repo.go index b38473b18a..556cc4343c 100644 --- a/routers/repo/repo.go +++ b/routers/repo/repo.go @@ -18,7 +18,7 @@ func Create(ctx *middleware.Context, form auth.CreateRepoForm) { ctx.Data["Licenses"] = models.Licenses if ctx.Req.Method == "GET" { - ctx.HTML(200, "repo/create", ctx.Data) + ctx.HTML(200, "repo/create") return } @@ -45,7 +45,7 @@ func SettingPost(ctx *middleware.Context) { case "delete": if len(ctx.Repo.Repository.Name) == 0 || ctx.Repo.Repository.Name != ctx.Query("repository") { ctx.Data["ErrorMsg"] = "Please make sure you entered repository name is correct." - ctx.HTML(200, "repo/setting", ctx.Data) + ctx.HTML(200, "repo/setting") return } diff --git a/routers/repo/single.go b/routers/repo/single.go index c10d30a7d6..ebf64dc665 100644 --- a/routers/repo/single.go +++ b/routers/repo/single.go @@ -38,7 +38,7 @@ func Branches(ctx *middleware.Context, params martini.Params) { ctx.Data["Branches"] = brs ctx.Data["IsRepoToolbarBranches"] = true - ctx.HTML(200, "repo/branches", ctx.Data) + ctx.HTML(200, "repo/branches") } func Single(ctx *middleware.Context, params martini.Params) { @@ -67,7 +67,7 @@ func Single(ctx *middleware.Context, params martini.Params) { return } else if len(brs) == 0 { ctx.Data["IsBareRepo"] = true - ctx.HTML(200, "repo/single", ctx.Data) + ctx.HTML(200, "repo/single") return } @@ -178,7 +178,7 @@ func Single(ctx *middleware.Context, params martini.Params) { ctx.Data["Treenames"] = treenames ctx.Data["IsRepoToolbarSource"] = true ctx.Data["BranchLink"] = branchLink - ctx.HTML(200, "repo/single", ctx.Data) + ctx.HTML(200, "repo/single") } func Setting(ctx *middleware.Context, params martini.Params) { @@ -195,7 +195,7 @@ func Setting(ctx *middleware.Context, params martini.Params) { return } else if len(brs) == 0 { ctx.Data["IsBareRepo"] = true - ctx.HTML(200, "repo/setting", ctx.Data) + ctx.HTML(200, "repo/setting") return } @@ -206,7 +206,7 @@ func Setting(ctx *middleware.Context, params martini.Params) { ctx.Data["Title"] = title + " - settings" ctx.Data["IsRepoToolbarSetting"] = true - ctx.HTML(200, "repo/setting", ctx.Data) + ctx.HTML(200, "repo/setting") } func Commits(ctx *middleware.Context, params martini.Params) { @@ -230,17 +230,17 @@ func Commits(ctx *middleware.Context, params martini.Params) { ctx.Data["Reponame"] = params["reponame"] ctx.Data["CommitCount"] = commits.Len() ctx.Data["Commits"] = commits - ctx.HTML(200, "repo/commits", ctx.Data) + ctx.HTML(200, "repo/commits") } func Issues(ctx *middleware.Context) { ctx.Data["IsRepoToolbarIssues"] = true - ctx.HTML(200, "repo/issues", ctx.Data) + ctx.HTML(200, "repo/issues") } func Pulls(ctx *middleware.Context) { ctx.Data["IsRepoToolbarPulls"] = true - ctx.HTML(200, "repo/pulls", ctx.Data) + ctx.HTML(200, "repo/pulls") } func Action(ctx *middleware.Context, params martini.Params) { diff --git a/routers/user/setting.go b/routers/user/setting.go index 053f327f0f..f0c7a8a5b1 100644 --- a/routers/user/setting.go +++ b/routers/user/setting.go @@ -24,13 +24,13 @@ func Setting(ctx *middleware.Context, form auth.UpdateProfileForm) { ctx.Data["Owner"] = user if ctx.Req.Method == "GET" { - ctx.HTML(200, "user/setting", ctx.Data) + ctx.HTML(200, "user/setting") return } // below is for POST requests if hasErr, ok := ctx.Data["HasError"]; ok && hasErr.(bool) { - ctx.HTML(200, "user/setting", ctx.Data) + ctx.HTML(200, "user/setting") return } @@ -45,7 +45,7 @@ func Setting(ctx *middleware.Context, form auth.UpdateProfileForm) { } ctx.Data["IsSuccess"] = true - ctx.HTML(200, "user/setting", ctx.Data) + ctx.HTML(200, "user/setting") log.Trace("%s User setting updated: %s", ctx.Req.RequestURI, ctx.User.LowerName) } @@ -55,7 +55,7 @@ func SettingPassword(ctx *middleware.Context, form auth.UpdatePasswdForm) { ctx.Data["IsUserPageSettingPasswd"] = true if ctx.Req.Method == "GET" { - ctx.HTML(200, "user/password", ctx.Data) + ctx.HTML(200, "user/password") return } @@ -82,7 +82,7 @@ func SettingPassword(ctx *middleware.Context, form auth.UpdatePasswdForm) { } ctx.Data["Owner"] = user - ctx.HTML(200, "user/password", ctx.Data) + ctx.HTML(200, "user/password") log.Trace("%s User password updated: %s", ctx.Req.RequestURI, ctx.User.LowerName) } @@ -123,7 +123,7 @@ func SettingSSHKeys(ctx *middleware.Context, form auth.AddSSHKeyForm) { // Add new SSH key. if ctx.Req.Method == "POST" { if hasErr, ok := ctx.Data["HasError"]; ok && hasErr.(bool) { - ctx.HTML(200, "user/publickey", ctx.Data) + ctx.HTML(200, "user/publickey") return } @@ -155,7 +155,7 @@ func SettingSSHKeys(ctx *middleware.Context, form auth.AddSSHKeyForm) { ctx.Data["PageIsUserSetting"] = true ctx.Data["IsUserPageSettingSSH"] = true ctx.Data["Keys"] = keys - ctx.HTML(200, "user/publickey", ctx.Data) + ctx.HTML(200, "user/publickey") } func SettingNotification(ctx *middleware.Context) { @@ -163,7 +163,7 @@ func SettingNotification(ctx *middleware.Context) { ctx.Data["Title"] = "Notification" ctx.Data["PageIsUserSetting"] = true ctx.Data["IsUserPageSettingNotify"] = true - ctx.HTML(200, "user/notification", ctx.Data) + ctx.HTML(200, "user/notification") } func SettingSecurity(ctx *middleware.Context) { @@ -171,5 +171,5 @@ func SettingSecurity(ctx *middleware.Context) { ctx.Data["Title"] = "Security" ctx.Data["PageIsUserSetting"] = true ctx.Data["IsUserPageSettingSecurity"] = true - ctx.HTML(200, "user/security", ctx.Data) + ctx.HTML(200, "user/security") } diff --git a/routers/user/user.go b/routers/user/user.go index f495cb13ab..2b759e4192 100644 --- a/routers/user/user.go +++ b/routers/user/user.go @@ -34,7 +34,7 @@ func Dashboard(ctx *middleware.Context) { return } ctx.Data["Feeds"] = feeds - ctx.HTML(200, "user/dashboard", ctx.Data) + ctx.HTML(200, "user/dashboard") } func Profile(ctx *middleware.Context, params martini.Params) { @@ -70,19 +70,19 @@ func Profile(ctx *middleware.Context, params martini.Params) { } ctx.Data["PageIsUserProfile"] = true - ctx.HTML(200, "user/profile", ctx.Data) + ctx.HTML(200, "user/profile") } func SignIn(ctx *middleware.Context, form auth.LogInForm) { ctx.Data["Title"] = "Log In" if ctx.Req.Method == "GET" { - ctx.HTML(200, "user/signin", ctx.Data) + ctx.HTML(200, "user/signin") return } if hasErr, ok := ctx.Data["HasError"]; ok && hasErr.(bool) { - ctx.HTML(200, "user/signin", ctx.Data) + ctx.HTML(200, "user/signin") return } @@ -113,7 +113,7 @@ func SignUp(ctx *middleware.Context, form auth.RegisterForm) { ctx.Data["PageIsSignUp"] = true if ctx.Req.Method == "GET" { - ctx.HTML(200, "user/signup", ctx.Data) + ctx.HTML(200, "user/signup") return } @@ -126,7 +126,7 @@ func SignUp(ctx *middleware.Context, form auth.RegisterForm) { } if ctx.HasError() { - ctx.HTML(200, "user/signup", ctx.Data) + ctx.HTML(200, "user/signup") return } @@ -158,7 +158,7 @@ func SignUp(ctx *middleware.Context, form auth.RegisterForm) { ctx.Data["IsSendRegisterMail"] = true ctx.Data["Email"] = u.Email ctx.Data["Hours"] = base.Service.ActiveCodeLives / 60 - ctx.Render.HTML(200, "user/active", ctx.Data) + ctx.HTML(200, "user/active") return } ctx.Redirect("/user/login") @@ -170,7 +170,7 @@ func Delete(ctx *middleware.Context) { ctx.Data["IsUserPageSettingDelete"] = true if ctx.Req.Method == "GET" { - ctx.HTML(200, "user/delete", ctx.Data) + ctx.HTML(200, "user/delete") return } @@ -195,7 +195,7 @@ func Delete(ctx *middleware.Context) { } } - ctx.HTML(200, "user/delete", ctx.Data) + ctx.HTML(200, "user/delete") } const ( @@ -218,15 +218,15 @@ func Feeds(ctx *middleware.Context, form auth.FeedsForm) { } func Issues(ctx *middleware.Context) { - ctx.HTML(200, "user/issues", ctx.Data) + ctx.HTML(200, "user/issues") } func Pulls(ctx *middleware.Context) { - ctx.HTML(200, "user/pulls", ctx.Data) + ctx.HTML(200, "user/pulls") } func Stars(ctx *middleware.Context) { - ctx.HTML(200, "user/stars", ctx.Data) + ctx.HTML(200, "user/stars") } func Activate(ctx *middleware.Context) { @@ -244,7 +244,7 @@ func Activate(ctx *middleware.Context) { } else { ctx.Data["ServiceNotEnabled"] = true } - ctx.Render.HTML(200, "user/active", ctx.Data) + ctx.HTML(200, "user/active") return } @@ -263,5 +263,5 @@ func Activate(ctx *middleware.Context) { } ctx.Data["IsActivateFailed"] = true - ctx.Render.HTML(200, "user/active", ctx.Data) + ctx.HTML(200, "user/active") } diff --git a/templates/admin/dashboard.tmpl b/templates/admin/dashboard.tmpl new file mode 100644 index 0000000000..84456c85b8 --- /dev/null +++ b/templates/admin/dashboard.tmpl @@ -0,0 +1,24 @@ +{{template "base/head" .}} +{{template "base/navbar" .}} +
+ + +
+
+
+ Statistic +
+ +
+ Gogs database has 4 users, 3 repositories, 4 SSH keys. +
+
+
+
+{{template "base/footer" .}} \ No newline at end of file diff --git a/templates/admin/repos.tmpl b/templates/admin/repos.tmpl new file mode 100644 index 0000000000..ec7f47e090 --- /dev/null +++ b/templates/admin/repos.tmpl @@ -0,0 +1,23 @@ +{{template "base/head" .}} +{{template "base/navbar" .}} +
+ + +
+
+
+ Repository Management +
+ +
+
+
+
+
+{{template "base/footer" .}} \ No newline at end of file diff --git a/templates/admin/users.tmpl b/templates/admin/users.tmpl new file mode 100644 index 0000000000..8acf256d05 --- /dev/null +++ b/templates/admin/users.tmpl @@ -0,0 +1,23 @@ +{{template "base/head" .}} +{{template "base/navbar" .}} +
+ + +
+
+
+ User Management +
+ +
+
+
+
+
+{{template "base/footer" .}} \ No newline at end of file diff --git a/templates/base/navbar.tmpl b/templates/base/navbar.tmpl index e0d796a87b..9c064d07e7 100644 --- a/templates/base/navbar.tmpl +++ b/templates/base/navbar.tmpl @@ -10,6 +10,7 @@ + {{if .IsAdmin}}{{end}} {{else}}Sign in{{end}}
diff --git a/templates/repo/setting.tmpl b/templates/repo/setting.tmpl index 06f0ed4d50..a2fb1771d4 100644 --- a/templates/repo/setting.tmpl +++ b/templates/repo/setting.tmpl @@ -10,20 +10,24 @@
  • Notifications
  • -->
    +
    {{if .ErrorMsg}}

    {{.ErrorMsg}}

    {{end}}
    Repository Options
    +
    +
    Danger Zone
    +
    + + + + + + +
    +

    We recommend every repository include a README, LICENSE, and .gitignore.

    +
    +

    Create a new repository on the command line

    +
    touch README.md
    +git init
    +git add README.md
    +git commit -m "first commit"
    +git remote add origin https://github.com/fuxiaohei/air.git
    +git push -u origin master
    +
    +

    Push an existing repository from the command line

    +
    git remote add origin https://github.com/fuxiaohei/air.git
    +git push -u origin master
    +
    +
    \ No newline at end of file diff --git a/templates/repo/toolbar.tmpl b/templates/repo/toolbar.tmpl index 5cd9f526b4..b51768a3c3 100644 --- a/templates/repo/toolbar.tmpl +++ b/templates/repo/toolbar.tmpl @@ -15,9 +15,8 @@
  • Release
  • Wiki
  • - + {{end}} - {{end}}