From e88ed75bddb8ffd30f1dbfc9ce3721a7ab80915b Mon Sep 17 00:00:00 2001
From: 28111600 <28111600@qq.com>
Date: Thu, 29 Jun 2017 08:31:28 +0800
Subject: [PATCH] Changes to be committed: modified:
routes/repo/view.go modified: templates/repo/view_file.tmpl
---
routes/repo/view.go | 12 ++++++------
templates/repo/view_file.tmpl | 10 +++++-----
2 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/routes/repo/view.go b/routes/repo/view.go
index 1ea25d51f..8fdcc11c2 100644
--- a/routes/repo/view.go
+++ b/routes/repo/view.go
@@ -186,15 +186,15 @@ 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(`
%s`, 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())
- output.Reset()
- for i := 0; i < len(lines); i++ {
- output.WriteString(fmt.Sprintf(`%d`, i+1, i+1))
- }
- c.Data["LineNums"] = gotemplate.HTML(output.String())
+ // output.Reset()
+ // for i := 0; i < len(lines); i++ {
+ // output.WriteString(fmt.Sprintf(`%d`, i+1, i+1))
+ // }
+ // c.Data["LineNums"] = gotemplate.HTML(output.String())
}
if canEnableEditor {
diff --git a/templates/repo/view_file.tmpl b/templates/repo/view_file.tmpl
index a093787e7..2abcc7107 100644
--- a/templates/repo/view_file.tmpl
+++ b/templates/repo/view_file.tmpl
@@ -82,14 +82,14 @@
{{else if .FileSize}}
-
+
{{if .IsFileTooLarge}}
- {{.i18n.Tr "repo.file_too_large"}} |
+
+ {{.i18n.Tr "repo.file_too_large"}} |
{{else}}
- {{.LineNums}} |
- {{.FileContent}}
|
+ {{.FileContent}}
{{end}}
-
+
{{end}}