From f9757ff9099f234d043033d2de263a5b6050adc0 Mon Sep 17 00:00:00 2001 From: Alexei Bezborodov Date: Fri, 5 Aug 2022 17:30:56 +0300 Subject: [PATCH] =?UTF-8?q?=D0=B8=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD?= =?UTF-8?q?=D0=B0=20=D1=81=D1=82=D0=B0=D1=80=D1=82=D0=BE=D0=B2=D0=B0=D1=8F?= =?UTF-8?q?=20=D1=81=D1=82=D1=80=D0=B0=D0=BD=D0=B8=D1=86=D0=B0=20=D1=81=20?= =?UTF-8?q?"=D0=9A=D0=BE=D0=B4=D0=B0"=20=D0=BD=D0=B0=20"=D0=92=D0=B8=D0=BA?= =?UTF-8?q?=D0=B8"=20#35?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- routers/web/repo/view.go | 10 ++++++++++ routers/web/web.go | 9 +++++---- templates/repo/header.tmpl | 2 +- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/routers/web/repo/view.go b/routers/web/repo/view.go index e98d94f7ca..da328ded45 100644 --- a/routers/web/repo/view.go +++ b/routers/web/repo/view.go @@ -697,6 +697,16 @@ func Home(ctx *context.Context) { return } + Wiki(ctx) +} + +// Code render repository page +func Code(ctx *context.Context) { + checkHomeCodeViewable(ctx) + if ctx.Written() { + return + } + renderCode(ctx) } diff --git a/routers/web/web.go b/routers/web/web.go index df09957b4a..aa946dd343 100644 --- a/routers/web/web.go +++ b/routers/web/web.go @@ -1042,11 +1042,11 @@ func RegisterRoutes(m *web.Route) { }, repo.MustBeNotEmpty, context.RepoRef(), reqRepoCodeReader) m.Group("/src", func() { - m.Get("/branch/*", context.RepoRefByType(context.RepoRefBranch), repo.Home) - m.Get("/tag/*", context.RepoRefByType(context.RepoRefTag), repo.Home) - m.Get("/commit/*", context.RepoRefByType(context.RepoRefCommit), repo.Home) + m.Get("/branch/*", context.RepoRefByType(context.RepoRefBranch), repo.Code) + m.Get("/tag/*", context.RepoRefByType(context.RepoRefTag), repo.Code) + m.Get("/commit/*", context.RepoRefByType(context.RepoRefCommit), repo.Code) // "/*" route is deprecated, and kept for backward compatibility - m.Get("/*", context.RepoRefByType(context.RepoRefLegacy), repo.Home) + m.Get("/*", context.RepoRefByType(context.RepoRefLegacy), repo.Code) }, repo.SetEditorconfigIfExists) m.Group("", func() { @@ -1067,6 +1067,7 @@ func RegisterRoutes(m *web.Route) { m.Group("/{username}", func() { m.Group("/{reponame}", func() { m.Get("", repo.SetEditorconfigIfExists, repo.Home) + m.Get("/code", repo.SetEditorconfigIfExists, repo.Code) }, ignSignIn, context.RepoAssignment, context.RepoRef(), context.UnitTypes()) m.Group("/{reponame}", func() { diff --git a/templates/repo/header.tmpl b/templates/repo/header.tmpl index 13c76de5aa..4948d90379 100644 --- a/templates/repo/header.tmpl +++ b/templates/repo/header.tmpl @@ -178,7 +178,7 @@ {{ end }} {{if .Permission.CanRead $.UnitTypeCode}} - + {{svg "octicon-code"}} {{.i18n.Tr "repo.code"}} {{end}} -- 2.11.0