From 1dd554e89f43fe78a43f2ba77799eb3a0a235f2e Mon Sep 17 00:00:00 2001 From: 28111600 <28111600@qq.com> Date: Thu, 29 Jun 2017 09:08:04 +0800 Subject: [PATCH] Changes to be committed: modified: public/css/gogs.css modified: routes/repo/view.go --- public/css/gogs.css | 58 ++++++++++----------------------------------- routes/repo/view.go | 2 +- 2 files changed, 13 insertions(+), 47 deletions(-) diff --git a/public/css/gogs.css b/public/css/gogs.css index 9768b784f..588d86cdf 100644 --- a/public/css/gogs.css +++ b/public/css/gogs.css @@ -1482,9 +1482,9 @@ footer .ui.language .menu { } .repository.file.list #file-content .code-view .blob-num { width: 1%; - min-width: 50px; - padding-right: 10px; - padding-left: 10px; + min-width: 50px; + line-height: 20px; + cursor: pointer; text-align: right; white-space: nowrap; vertical-align: top; @@ -1493,60 +1493,26 @@ footer .ui.language .menu { -moz-user-select: none; -ms-user-select: none; user-select: none; -} - -.repository.file.list #file-content .code-view .lines-num { - vertical-align: top; - text-align: right; color: #999; background: #f5f5f5; - width: 1%; } -.repository.file.list #file-content .code-view .lines-num span { - line-height: 20px; +.repository.file.list #file-content .code-view .blob-num, +.repository.file.list #file-content .code-view .blob-code { padding: 0 10px; - cursor: pointer; - display: block; -} -.repository.file.list #file-content .code-view .lines-num, -.repository.file.list #file-content .code-view .lines-code { - padding: 0; } -.repository.file.list #file-content .code-view .lines-num pre, -.repository.file.list #file-content .code-view .lines-code pre, -.repository.file.list #file-content .code-view .lines-num ol, -.repository.file.list #file-content .code-view .lines-code ol, -.repository.file.list #file-content .code-view .lines-num .hljs, -.repository.file.list #file-content .code-view .lines-code .hljs { +.repository.file.list #file-content .code-view .blob-code pre, +.repository.file.list #file-content .code-view .blob-code .hljs { background-color: white; margin: 0; padding: 0 !important; } -.repository.file.list #file-content .code-view .lines-num pre li, -.repository.file.list #file-content .code-view .lines-code pre li, -.repository.file.list #file-content .code-view .lines-num ol li, -.repository.file.list #file-content .code-view .lines-code ol li, -.repository.file.list #file-content .code-view .lines-num .hljs li, -.repository.file.list #file-content .code-view .lines-code .hljs li { - display: inline-block; - width: 100%; -} -.repository.file.list #file-content .code-view .lines-num pre li.active, -.repository.file.list #file-content .code-view .lines-code pre li.active, -.repository.file.list #file-content .code-view .lines-num ol li.active, -.repository.file.list #file-content .code-view .lines-code ol li.active, -.repository.file.list #file-content .code-view .lines-num .hljs li.active, -.repository.file.list #file-content .code-view .lines-code .hljs li.active { + +.repository.file.list #file-content .code-view .blob-code pre li.active, +.repository.file.list #file-content .code-view .blob-code ol li.active, +.repository.file.list #file-content .code-view .blob-code .hljs li.active { background: #ffffdd; } -.repository.file.list #file-content .code-view .lines-num pre li:before, -.repository.file.list #file-content .code-view .lines-code pre li:before, -.repository.file.list #file-content .code-view .lines-num ol li:before, -.repository.file.list #file-content .code-view .lines-code ol li:before, -.repository.file.list #file-content .code-view .lines-num .hljs li:before, -.repository.file.list #file-content .code-view .lines-code .hljs li:before { - content: ' '; -} + .repository.file.list .sidebar { padding-left: 0; } diff --git a/routes/repo/view.go b/routes/repo/view.go index c5a030d47..cc511f7ea 100644 --- a/routes/repo/view.go +++ b/routes/repo/view.go @@ -186,7 +186,7 @@ func renderFile(c *context.Context, entry *git.TreeEntry, treeLink, rawLink stri var output bytes.Buffer lines := strings.Split(fileContent, "\n") for index, line := range lines { - output.WriteString(fmt.Sprintf(`%d%s`, index+1, index+1, index+1, gotemplate.HTMLEscapeString(strings.TrimRight(line, "\r"))) + "\n") + output.WriteString(fmt.Sprintf(`%d
%s
`, index+1, index+1, index+1, gotemplate.HTMLEscapeString(strings.TrimRight(line, "\r"))) + "\n") } c.Data["FileContent"] = gotemplate.HTML(output.String())