Skip to content

Commit 14a6066

Browse files
committed
improve repo ref
1 parent 4eae5fe commit 14a6066

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

routers/web/web.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1332,7 +1332,7 @@ func registerRoutes(m *web.Router) {
13321332

13331333
m.Group("/{username}/{reponame}", func() { // repo tags
13341334
m.Group("/tags", func() {
1335-
m.Get("", context.RepoRefByDefaultBranch(), repo.TagsList)
1335+
m.Get("", context.RepoRefByDefaultBranch() /* for the "commits" tab */, repo.TagsList)
13361336
m.Get(".rss", feedEnabled, repo.TagsListFeedRSS)
13371337
m.Get(".atom", feedEnabled, repo.TagsListFeedAtom)
13381338
m.Get("/list", repo.GetTagList)
@@ -1522,7 +1522,7 @@ func registerRoutes(m *web.Router) {
15221522

15231523
m.Group("/branches", func() {
15241524
m.Get("/list", repo.GetBranchesList)
1525-
m.Get("", context.RepoRefByDefaultBranch(), repo.Branches)
1525+
m.Get("", context.RepoRefByDefaultBranch() /* for the "commits" tab */, repo.Branches)
15261526
}, repo.MustBeNotEmpty)
15271527

15281528
m.Group("/media", func() {

services/context/repo.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -783,10 +783,9 @@ func RepoRefByDefaultBranch() func(*Context) {
783783
ctx.Repo.BranchName = ctx.Repo.Repository.DefaultBranch
784784
ctx.Repo.Commit, _ = ctx.Repo.GitRepo.GetBranchCommit(ctx.Repo.BranchName)
785785
ctx.Repo.CommitsCount, _ = ctx.Repo.GetCommitsCount()
786+
ctx.Data["RefFullName"] = ctx.Repo.RefFullName
786787
ctx.Data["BranchName"] = ctx.Repo.BranchName
787-
ctx.Data["TreePath"] = ""
788788
ctx.Data["CommitsCount"] = ctx.Repo.CommitsCount
789-
ctx.Data["RefTypeNameSubURL"] = ctx.Repo.RefTypeNameSubURL()
790789
}
791790
}
792791

templates/repo/sub_menu.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<div class="ui segments repository-summary tw-mt-1 tw-mb-0">
33
<div class="ui segment sub-menu repository-menu">
44
{{if and (.Permission.CanRead ctx.Consts.RepoUnitTypeCode) (not .IsEmptyRepo)}}
5-
<a class="item muted {{if .PageIsCommits}}active{{end}}" href="{{.RepoLink}}/commits/{{.RefTypeNameSubURL}}">
5+
<a class="item muted {{if .PageIsCommits}}active{{end}}" href="{{.RepoLink}}/commits/{{.RefFullName.RefWebLinkPath}}">
66
{{svg "octicon-history"}} <b>{{ctx.Locale.PrettyNumber .CommitsCount}}</b> {{ctx.Locale.TrN .CommitsCount "repo.commit" "repo.commits"}}
77
</a>
88
<a class="item muted {{if .PageIsBranches}}active{{end}}" href="{{.RepoLink}}/branches">

0 commit comments

Comments
 (0)