From ee93186f72262e702661df1469d72546de426787 Mon Sep 17 00:00:00 2001 From: Unknown Date: Mon, 17 Mar 2014 06:58:34 -0400 Subject: [PATCH 1/2] Mirror change --- .gitignore | 1 - routers/repo/single.go | 15 +++++---------- templates/repo/commits.tmpl | 9 +++++++++ 3 files changed, 14 insertions(+), 11 deletions(-) create mode 100644 templates/repo/commits.tmpl diff --git a/.gitignore b/.gitignore index 55d2a5784c..6559d61a06 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,3 @@ gogs *.log custom/ .vendor/ -repo/ diff --git a/routers/repo/single.go b/routers/repo/single.go index f47a2f7bfc..acbf9dd0a9 100644 --- a/routers/repo/single.go +++ b/routers/repo/single.go @@ -88,15 +88,9 @@ func Single(ctx *middleware.Context, params martini.Params) { var readmeFile *models.RepoFile for _, f := range files { - if !f.IsFile() { + if !f.IsFile() || len(f.Name) < 6 { continue - } - - if len(f.Name) < 6 { - continue - } - - if strings.ToLower(f.Name[:6]) == "readme" { + } else if strings.ToLower(f.Name[:6]) == "readme" { readmeFile = f break } @@ -136,8 +130,9 @@ func Setting(ctx *middleware.Context, params martini.Params) { ctx.Render.HTML(200, "repo/setting", ctx.Data) } -func Commits(ctx *middleware.Context) string { - return "This is commits page" +func Commits(ctx *middleware.Context) { + ctx.Data["IsRepoToolbarCommits"] = true + ctx.Render.HTML(200, "repo/commits", ctx.Data) } func Issues(ctx *middleware.Context) string { diff --git a/templates/repo/commits.tmpl b/templates/repo/commits.tmpl new file mode 100644 index 0000000000..7ebe68b6a0 --- /dev/null +++ b/templates/repo/commits.tmpl @@ -0,0 +1,9 @@ +{{template "base/head" .}} +{{template "base/navbar" .}} +{{template "repo/nav" .}} +{{template "repo/toolbar" .}} +
+
+
+
+{{template "base/footer" .}} \ No newline at end of file From f90e37ade0bcb82a8381e861730b87399e4a3b45 Mon Sep 17 00:00:00 2001 From: slene Date: Mon, 17 Mar 2014 19:56:33 +0800 Subject: [PATCH 2/2] fixed --- routers/repo/single.go | 1 + templates/repo/single.tmpl | 2 ++ 2 files changed, 3 insertions(+) diff --git a/routers/repo/single.go b/routers/repo/single.go index acbf9dd0a9..cf64cc6b52 100644 --- a/routers/repo/single.go +++ b/routers/repo/single.go @@ -97,6 +97,7 @@ func Single(ctx *middleware.Context, params martini.Params) { } if readmeFile != nil { + ctx.Data["ReadmeExist"] = true // if file large than 1M not show it if readmeFile.Size > 1024*1024 || readmeFile.Filemode != git.FileModeBlob { ctx.Data["FileIsLarge"] = true diff --git a/templates/repo/single.tmpl b/templates/repo/single.tmpl index c22f129fb7..561deb253f 100644 --- a/templates/repo/single.tmpl +++ b/templates/repo/single.tmpl @@ -83,6 +83,7 @@ + {{if .ReadmeExist}}
README.md @@ -97,6 +98,7 @@
{{end}}
+ {{end}} {{template "base/footer" .}} \ No newline at end of file