From f6bea954e6278d44f498e11b31dbc5af9408f9cd Mon Sep 17 00:00:00 2001 From: "brian.paulson" Date: Thu, 16 Mar 2017 07:52:47 -0600 Subject: [PATCH 1/4] Adding hilighting type and lines count to file view header --- routers/repo/view.go | 1 + templates/repo/view_file.tmpl | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/routers/repo/view.go b/routers/repo/view.go index 3f7165d71..79cf29f35 100644 --- a/routers/repo/view.go +++ b/routers/repo/view.go @@ -184,6 +184,7 @@ func renderFile(ctx *context.Context, entry *git.TreeEntry, treeLink, rawLink st output.WriteString(fmt.Sprintf(`%d`, i+1, i+1)) } ctx.Data["LineNums"] = gotemplate.HTML(output.String()) + ctx.Data["LineCount"] = len(lines) } if canEnableEditor { diff --git a/templates/repo/view_file.tmpl b/templates/repo/view_file.tmpl index fe68b7cb6..e2449e431 100644 --- a/templates/repo/view_file.tmpl +++ b/templates/repo/view_file.tmpl @@ -5,11 +5,22 @@ {{if .ReadmeInList}} {{.FileName}} {{else}} - {{.FileName}} {{FileSize .FileSize}} + {{end}} {{else}} - - {{.FileName}} {{FileSize .FileSize}} + {{end}} {{if not .ReadmeInList}}
From 1fcb57fab166681ab4f4165dfb4c9ee11d0d3066 Mon Sep 17 00:00:00 2001 From: "brian.paulson" Date: Fri, 17 Mar 2017 07:44:11 -0600 Subject: [PATCH 2/4] Added logic to handle readme files --- templates/repo/view_file.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/repo/view_file.tmpl b/templates/repo/view_file.tmpl index e2449e431..7cfb29838 100644 --- a/templates/repo/view_file.tmpl +++ b/templates/repo/view_file.tmpl @@ -2,7 +2,7 @@

{{if .ReadmeExist}} - {{if .ReadmeInList}} + {{if or (.ReadmeInList) (not .LineCount)}} {{.FileName}} {{else}}