diff --git a/routers/repo/repo.go b/routers/repo/repo.go index 76d55554b..cd28d52ca 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 45586012b..cf398595e 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}}