From c9bf526be74a29a9f2e620cbcd06989a40597531 Mon Sep 17 00:00:00 2001 From: slene Date: Sun, 16 Mar 2014 23:25:01 +0800 Subject: markdown & code style --- public/css/gogs.css | 17 ++- public/css/markdown.css | 317 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 333 insertions(+), 1 deletion(-) create mode 100644 public/css/markdown.css (limited to 'public/css') diff --git a/public/css/gogs.css b/public/css/gogs.css index 545e2b0b..89da6055 100755 --- a/public/css/gogs.css +++ b/public/css/gogs.css @@ -560,7 +560,9 @@ html, body { .file-list .icon { font-size: 17px; padding: 5px 0 4px 10px; - width: 40px; + width: 50px; + color: #999; + text-align: right; } .file-list .wrap { @@ -588,6 +590,19 @@ html, body { text-align: right; } +.file-content .file-head { + font-size: 18px; +} + +.file-content .file-head .icon { + color: #666; + margin: 0 .5em 0 0; +} + +.file-content .file-body { + padding: 30px 30px 50px; +} + #wrapper { min-height: 100%; height: auto !important; diff --git a/public/css/markdown.css b/public/css/markdown.css new file mode 100644 index 00000000..e2b15c2f --- /dev/null +++ b/public/css/markdown.css @@ -0,0 +1,317 @@ +.markdown { + font-size: 14px; +} + +.markdown a { + color: #4183C4; +} + +.markdown h1, +.markdown h2, +.markdown h3, +.markdown h4, +.markdown h5, +.markdown h6 { + line-height: 1.7; + padding: 15px 0 0; + margin: 0 0 15px; + color: #666; +} + +.markdown h1, +.markdown h2 { + border-bottom: 1px solid #EEE; +} + +.markdown h2 { + border-bottom: 1px solid #EEE; +} + +.markdown h1 { + color: #000; + font-size: 33px +} + +.markdown h2 { + color: #333; + font-size: 28px +} + +.markdown h3 { + font-size: 22px +} + +.markdown h4 { + font-size: 18px +} + +.markdown h5 { + font-size: 14px +} + +.markdown h6 { + font-size: 14px +} + +.markdown table { + border-collapse: collapse; + border-spacing: 0; + display: block; + overflow: auto; + width: 100%; + margin: 0 0 9px; +} + +.markdown table th { + font-weight: 700 +} + +.markdown table th, +.markdown table td { + border: 1px solid #DDD; + padding: 6px 13px; +} + +.markdown table tr { + background-color: #FFF; + border-top: 1px solid #CCC; +} + +.markdown table tr:nth-child(2n) { + background-color: #F8F8F8 +} + +.markdown li { + line-height: 1.6; + margin-top: 6px; +} + +.markdown dl dt { + font-style: italic; + margin-top: 9px; +} + +.markdown dl dd { + margin: 0 0 9px; + padding: 0 9px; +} + +.markdown blockquote, +.markdown blockquote p { + font-size: 14px; + background-color: #f5f5f5; +} + +.markdown > pre { + line-height: 1.6; + overflow: auto; + background: #fff; + padding: 6px 10px; + border: 1px solid #ddd; +} + +.markdown > pre.linenums { + padding: 0; +} + +.markdown > pre > ol.linenums { + -webkit-box-shadow: inset 40px 0 0 #f5f5f5, inset 41px 0 0 #ccc; + box-shadow: inset 40px 0 0 #f5f5f5, inset 41px 0 0 #ccc; +} + +.markdown > pre > code, +.markdown > pre > ol.linenums > li > code { + white-space: pre; + word-wrap: normal; +} + +.markdown > pre > ol.linenums > li > code { + padding: 0 10px; +} + +.markdown > pre > ol.linenums > li:first-child { + padding-top: 6px; +} + +.markdown > pre > ol.linenums > li:last-child { + padding-bottom: 6px; +} + +.markdown > pre > ol.linenums > li { + border-left: 1px solid #ddd; +} + +.markdown hr { + border: none; + color: #ccc; + height: 4px; + padding: 0; + margin: 15px 0; + border-bottom: 2px solid #EEE; +} + +.markdown blockquote:last-child, +.markdown ul:last-child, +.markdown ol:last-child, +.markdown > pre:last-child, +.markdown > pre:last-child, +.markdown p:last-child { + margin-bottom: 0; +} + +.markdown .btn { + color: #fff; +} + +/* Author: jmblog */ +/* Project: https://github.com/jmblog/color-themes-for-google-code-prettify */ +/* GitHub Theme */ +/* Pretty printing styles. Used with prettify.js. */ +/* SPAN elements with the classes below are added by prettyprint. */ +/* plain text */ +.pln { + color: #333333; +} + +@media screen { + /* string content */ + .str { + color: #dd1144; + } + + /* a keyword */ + .kwd { + color: #333333; + } + + /* a comment */ + .com { + color: #999988; + } + + /* a type name */ + .typ { + color: #445588; + } + + /* a literal value */ + .lit { + color: #445588; + } + + /* punctuation */ + .pun { + color: #333333; + } + + /* lisp open bracket */ + .opn { + color: #333333; + } + + /* lisp close bracket */ + .clo { + color: #333333; + } + + /* a markup tag name */ + .tag { + color: navy; + } + + /* a markup attribute name */ + .atn { + color: teal; + } + + /* a markup attribute value */ + .atv { + color: #dd1144; + } + + /* a declaration */ + .dec { + color: #333333; + } + + /* a variable name */ + .var { + color: teal; + } + + /* a function name */ + .fun { + color: #990000; + } +} +/* Use higher contrast and text-weight for printable form. */ +@media print, projection { + .str { + color: #006600; + } + + .kwd { + color: #006; + font-weight: bold; + } + + .com { + color: #600; + font-style: italic; + } + + .typ { + color: #404; + font-weight: bold; + } + + .lit { + color: #004444; + } + + .pun, .opn, .clo { + color: #444400; + } + + .tag { + color: #006; + font-weight: bold; + } + + .atn { + color: #440044; + } + + .atv { + color: #006600; + } +} + +/* Specify class=linenums on a pre to get line numbering */ +ol.linenums { + margin-top: 0; + margin-bottom: 0; +} + +/* IE indents via margin-left */ +li.L0, +li.L1, +li.L2, +li.L3, +li.L4, +li.L5, +li.L6, +li.L7, +li.L8, +li.L9 { + /* */ +} + +/* Alternate shading for lines */ +li.L1, +li.L3, +li.L5, +li.L7, +li.L9 { + /* */ +} \ No newline at end of file -- cgit v1.2.3 From ec65be79f0337b11c01121eae9fd54fe49bee830 Mon Sep 17 00:00:00 2001 From: Unknown Date: Sun, 16 Mar 2014 12:07:35 -0400 Subject: Fix commit feed ui --- gogs.go | 2 +- modules/base/tool.go | 17 ++++++++++------- public/css/gogs.css | 6 ++++++ routers/user/user.go | 2 +- templates/user/profile.tmpl | 3 ++- 5 files changed, 20 insertions(+), 10 deletions(-) (limited to 'public/css') diff --git a/gogs.go b/gogs.go index 9d1f2032..2d5283f3 100644 --- a/gogs.go +++ b/gogs.go @@ -20,7 +20,7 @@ import ( // Test that go1.1 tag above is included in builds. main.go refers to this definition. const go11tag = true -const APP_VER = "0.0.8.0316.1" +const APP_VER = "0.0.9.0316.1" func init() { base.AppVer = APP_VER diff --git a/modules/base/tool.go b/modules/base/tool.go index 5746cc8f..10b3fee3 100644 --- a/modules/base/tool.go +++ b/modules/base/tool.go @@ -5,6 +5,7 @@ package base import ( + "bytes" "crypto/md5" "encoding/hex" "encoding/json" @@ -253,16 +254,14 @@ func ActionIcon(opType int) string { } const ( - TPL_CREATE_REPO = `%s created repository %s` - TPL_COMMIT_REPO = `%s pushed to %s at %s/%s -` + TPL_CREATE_REPO = `%s created repository %s` + TPL_COMMIT_REPO = `%s pushed to %s at %s/%s%s` + TPL_COMMIT_REPO_LI = `
user-avatar %s %s
` ) // ActionDesc accepts int that represents action operation type // and returns the description. -func ActionDesc(act Actioner) string { +func ActionDesc(act Actioner, avatarLink string) string { actUserName := act.GetActUserName() repoName := act.GetRepoName() content := act.GetContent() @@ -274,8 +273,12 @@ func ActionDesc(act Actioner) string { if err := json.Unmarshal([]byte(content), &commits); err != nil { return err.Error() } + buf := bytes.NewBuffer([]byte("\n")) + for _, commit := range commits { + buf.WriteString(fmt.Sprintf(TPL_COMMIT_REPO_LI, avatarLink, actUserName, repoName, commit[0], commit[0][:7], commit[1]) + "\n") + } return fmt.Sprintf(TPL_COMMIT_REPO, actUserName, actUserName, actUserName, repoName, "master", "master", actUserName, repoName, actUserName, repoName, - actUserName, repoName, commits[0][0], commits[0][0][:7], commits[0][1]) + buf.String()) default: return "invalid type" } diff --git a/public/css/gogs.css b/public/css/gogs.css index 89da6055..45ce5d21 100755 --- a/public/css/gogs.css +++ b/public/css/gogs.css @@ -228,6 +228,12 @@ html, body { border-radius: 6px; } +#gogs-user-avatar-commit { + width: 16px; + height: 16px; + border-radius: 2px; +} + #gogs-user-name { margin-top: 20px; font-size: 1.6em; diff --git a/routers/user/user.go b/routers/user/user.go index 0ff5058d..c43cf84a 100644 --- a/routers/user/user.go +++ b/routers/user/user.go @@ -195,7 +195,7 @@ func Feeds(ctx *middleware.Context, form auth.FeedsForm) { feeds := make([]string, len(actions)) for i := range actions { feeds[i] = fmt.Sprintf(feedTpl, base.ActionIcon(actions[i].OpType), - base.TimeSince(actions[i].Created), base.ActionDesc(actions[i])) + base.TimeSince(actions[i].Created), base.ActionDesc(actions[i], ctx.User.AvatarLink())) } ctx.Render.JSON(200, &feeds) } diff --git a/templates/user/profile.tmpl b/templates/user/profile.tmpl index 84d3b13c..24ae76fe 100644 --- a/templates/user/profile.tmpl +++ b/templates/user/profile.tmpl @@ -32,10 +32,11 @@ {{if eq .TabName "activity"}}
    + {{$avatarLink := .Owner.AvatarLink}} {{range .Feeds}}
  • -
    {{TimeSince .Created}}
    {{ActionDesc . | str2html}}
    +
    {{TimeSince .Created}}
    {{ActionDesc . $avatarLink | str2html}}
  • {{else}} -- cgit v1.2.3 From cc3cbf8cbee4b28902abc7fccee60499bd4c1246 Mon Sep 17 00:00:00 2001 From: FuXiaoHei Date: Mon, 17 Mar 2014 11:22:07 +0800 Subject: ui css fix --- public/css/gogs.css | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'public/css') diff --git a/public/css/gogs.css b/public/css/gogs.css index 45ce5d21..2c05d27e 100755 --- a/public/css/gogs.css +++ b/public/css/gogs.css @@ -65,6 +65,10 @@ html, body { height: 46px; } +#gogs-nav-logo{ + padding-left: 0; +} + .gogs-nav-item:hover, .gogs-nav-item:focus { color: #fff; @@ -405,6 +409,7 @@ html, body { .gogs-repo-nav h3 .fa { color: #BBB; + margin-left: 0; } .gogs-repo-btns { @@ -481,7 +486,7 @@ html, body { .activity-list .info { float: left; - padding:0 0 0 10px; + padding: 0 0 0 10px; line-height: 1.7em; } @@ -531,6 +536,10 @@ html, body { } /* #gogs-source */ +#gogs-source { + margin-top: -20px; +} + #gogs-source .source-toolbar:after { clear: both; } @@ -589,7 +598,7 @@ html, body { .file-list .date .wrap { max-width: 120px; - padding: 0 20px 0 0; + padding: 0 20px 0 0; } .file-list .date { -- cgit v1.2.3 From c101471bdfd0a802e66adfb7402dbd980812da30 Mon Sep 17 00:00:00 2001 From: FuXiaoHei Date: Mon, 17 Mar 2014 13:12:28 +0800 Subject: ui update, repo-assignment panic bug fix --- modules/middleware/repo.go | 2 +- public/css/gogs.css | 1 + routers/repo/single.go | 2 -- templates/base/head.tmpl | 4 +++- templates/repo/toolbar.tmpl | 3 ++- 5 files changed, 7 insertions(+), 5 deletions(-) (limited to 'public/css') diff --git a/modules/middleware/repo.go b/modules/middleware/repo.go index 8cdc6df7..7a415736 100644 --- a/modules/middleware/repo.go +++ b/modules/middleware/repo.go @@ -24,7 +24,6 @@ func RepoAssignment(redirect bool) martini.Handler { // get repository owner ctx.Repo.IsOwner = ctx.IsSigned && ctx.User.LowerName == params["username"] - ctx.Data["IsRepositoryOwner"] = ctx.Repo.IsOwner if !ctx.Repo.IsOwner { user, err = models.GetUserByName(params["username"]) @@ -70,5 +69,6 @@ func RepoAssignment(redirect bool) martini.Handler { ctx.Data["Owner"] = user ctx.Data["Title"] = user.Name + "/" + repo.Name ctx.Data["RepositoryLink"] = ctx.Data["Title"] + ctx.Data["IsRepositoryOwner"] = ctx.Repo.IsOwner } } diff --git a/public/css/gogs.css b/public/css/gogs.css index 2c05d27e..f98cf7a1 100755 --- a/public/css/gogs.css +++ b/public/css/gogs.css @@ -10,6 +10,7 @@ body { html, body { height: 100%; + font-family: Helvetica, Arial, sans-serif; } /* override bs3 */ diff --git a/routers/repo/single.go b/routers/repo/single.go index 6bf03ca2..3541dac9 100644 --- a/routers/repo/single.go +++ b/routers/repo/single.go @@ -46,7 +46,6 @@ func Single(ctx *middleware.Context, params martini.Params) { ctx.Data["Paths"] = Paths ctx.Data["Treenames"] = treenames ctx.Data["IsRepoToolbarSource"] = true - ctx.Data["IsRepositoryOwner"] = strings.ToLower(params["username"]) == ctx.User.LowerName ctx.Data["Files"] = files ctx.Render.HTML(200, "repo/single", ctx.Data) } @@ -63,7 +62,6 @@ func Setting(ctx *middleware.Context, params martini.Params) { ctx.Data["Title"] = title + " - settings" ctx.Data["IsRepoToolbarSetting"] = true - ctx.Data["IsRepositoryOwner"] = strings.ToLower(params["username"]) == ctx.User.LowerName ctx.Render.HTML(200, "repo/setting", ctx.Data) } diff --git a/templates/base/head.tmpl b/templates/base/head.tmpl index da100975..f02ea095 100644 --- a/templates/base/head.tmpl +++ b/templates/base/head.tmpl @@ -3,7 +3,9 @@ - + + + diff --git a/templates/repo/toolbar.tmpl b/templates/repo/toolbar.tmpl index 4a0b60ad..3729edaf 100644 --- a/templates/repo/toolbar.tmpl +++ b/templates/repo/toolbar.tmpl @@ -5,8 +5,9 @@
- +
\ No newline at end of file diff --git a/templates/user/dashboard.tmpl b/templates/user/dashboard.tmpl index 547e8ab5..c528185c 100644 --- a/templates/user/dashboard.tmpl +++ b/templates/user/dashboard.tmpl @@ -11,7 +11,7 @@

News Feed

-
+
{{if .HasInfo}}
{{.InfoMsg}}
{{end}}