From 123c7b44e81ce5e51448a01965843516b586e3e0 Mon Sep 17 00:00:00 2001 From: slene Date: Tue, 25 Mar 2014 00:42:57 +0800 Subject: [PATCH] fix --- routers/repo/repo.go | 1 + templates/repo/single_file.tmpl | 22 ++++++++++++++-------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/routers/repo/repo.go b/routers/repo/repo.go index 76d55554bc..cd28d52caa 100644 --- a/routers/repo/repo.go +++ b/routers/repo/repo.go @@ -156,6 +156,7 @@ func Single(ctx *middleware.Context, params martini.Params) { } if readmeFile != nil { + ctx.Data["ReadmeInSingle"] = true ctx.Data["ReadmeExist"] = true if blob, err := readmeFile.LookupBlob(); err != nil { ctx.Handle(404, "repo.Single(readmeFile.LookupBlob)", err) diff --git a/templates/repo/single_file.tmpl b/templates/repo/single_file.tmpl index 45586012ba..cf398595e5 100644 --- a/templates/repo/single_file.tmpl +++ b/templates/repo/single_file.tmpl @@ -2,22 +2,28 @@
{{if .ReadmeExist}} + {{if .ReadmeInSingle}} {{.FileName}} + {{else}} + {{.FileName}} {{FileSize .FileSize}} + {{end}} {{else}} {{.FileName}} {{FileSize .FileSize}} -
- - Raw - - - -
+ {{end}} + {{if not .ReadmeInSingle}} +
+ + Raw + + + +
{{end}}
{{if not .FileIsText}} {{else}} {{if .ReadmeExist}}