Browse Source

Merge pull request 'Изменилась стартовая вкладка с Кода на Вики #35' (#94) from wiki_start_page into dev_mirocod

Reviewed-on: http://git.mirocod.ru/MIROCOD/Platform_Mirocod/pulls/94
pull/43/head
parent
commit
309bd22339
  1. 10
      routers/web/repo/view.go
  2. 9
      routers/web/web.go
  3. 2
      templates/repo/header.tmpl

10
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)
}

9
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() {

2
templates/repo/header.tmpl

@ -178,7 +178,7 @@
{{ end }}
{{if .Permission.CanRead $.UnitTypeCode}}
<a class="{{if .PageIsViewCode}}active{{end}} item" href="{{.RepoLink}}{{if (ne .BranchName .Repository.DefaultBranch)}}/src/{{.BranchNameSubURL}}{{end}}">
<a class="{{if .PageIsViewCode}}active{{end}} item" href="{{.RepoLink}}{{if (ne .BranchName .Repository.DefaultBranch)}}/src/{{.BranchNameSubURL}}{{else}}/code{{end}}">
{{svg "octicon-code"}} {{.i18n.Tr "repo.code"}}
</a>
{{end}}

Loading…
Cancel
Save