Forks repository list page follow other repositories page (#34784)

Replace #24130 

Before:


![image](https://github.com/user-attachments/assets/98c39bce-bdbf-4fc1-b476-527c5139e01f)

After:

![image](https://github.com/user-attachments/assets/65fef5b8-63b9-4283-b8ea-2ac2f27cb001)
This commit is contained in:
Lunny Xiao 2025-06-22 03:27:25 +08:00 committed by GitHub
parent 0548c10293
commit ddd1e6ca83
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 26 additions and 27 deletions

View File

@ -151,6 +151,7 @@ func Repos(ctx *context.Context) {
ctx.Data["CodePageIsDisabled"] = setting.Service.Explore.DisableCodePage ctx.Data["CodePageIsDisabled"] = setting.Service.Explore.DisableCodePage
ctx.Data["Title"] = ctx.Tr("explore") ctx.Data["Title"] = ctx.Tr("explore")
ctx.Data["PageIsExplore"] = true ctx.Data["PageIsExplore"] = true
ctx.Data["ShowRepoOwnerOnList"] = true
ctx.Data["PageIsExploreRepositories"] = true ctx.Data["PageIsExploreRepositories"] = true
ctx.Data["IsRepoIndexerEnabled"] = setting.Indexer.RepoIndexerEnabled ctx.Data["IsRepoIndexerEnabled"] = setting.Indexer.RepoIndexerEnabled

View File

@ -394,9 +394,10 @@ func Forks(ctx *context.Context) {
} }
pager := context.NewPagination(int(total), pageSize, page, 5) pager := context.NewPagination(int(total), pageSize, page, 5)
ctx.Data["ShowRepoOwnerAvatar"] = true
ctx.Data["ShowRepoOwnerOnList"] = true
ctx.Data["Page"] = pager ctx.Data["Page"] = pager
ctx.Data["Repos"] = forks
ctx.Data["Forks"] = forks
ctx.HTML(http.StatusOK, tplForks) ctx.HTML(http.StatusOK, tplForks)
} }

View File

@ -197,6 +197,7 @@ func prepareUserProfileTabData(ctx *context.Context, profileDbRepo *repo_model.R
total = int(count) total = int(count)
case "stars": case "stars":
ctx.Data["PageIsProfileStarList"] = true ctx.Data["PageIsProfileStarList"] = true
ctx.Data["ShowRepoOwnerOnList"] = true
repos, count, err = repo_model.SearchRepository(ctx, repo_model.SearchRepoOptions{ repos, count, err = repo_model.SearchRepository(ctx, repo_model.SearchRepoOptions{
ListOptions: db.ListOptions{ ListOptions: db.ListOptions{
PageSize: pagingNum, PageSize: pagingNum,

View File

@ -26,7 +26,7 @@
{{ctx.Locale.Tr "admin.repositories"}} ({{ctx.Locale.Tr "admin.total" .ReposTotal}}) {{ctx.Locale.Tr "admin.repositories"}} ({{ctx.Locale.Tr "admin.total" .ReposTotal}})
</h4> </h4>
<div class="ui attached segment"> <div class="ui attached segment">
{{template "explore/repo_list" .}} {{template "shared/repo/list" .}}
</div> </div>
<h4 class="ui top attached header"> <h4 class="ui top attached header">
{{ctx.Locale.Tr "settings.organization"}} ({{ctx.Locale.Tr "admin.total" .OrgsTotal}}) {{ctx.Locale.Tr "settings.organization"}} ({{ctx.Locale.Tr "admin.total" .OrgsTotal}})

View File

@ -2,8 +2,8 @@
<div role="main" aria-label="{{.Title}}" class="page-content explore repositories"> <div role="main" aria-label="{{.Title}}" class="page-content explore repositories">
{{template "explore/navbar" .}} {{template "explore/navbar" .}}
<div class="ui container"> <div class="ui container">
{{template "shared/repo_search" .}} {{template "shared/repo/search" .}}
{{template "explore/repo_list" .}} {{template "shared/repo/list" .}}
{{template "base/paginate" .}} {{template "base/paginate" .}}
</div> </div>
</div> </div>

View File

@ -8,8 +8,8 @@
{{if .ProfileReadmeContent}} {{if .ProfileReadmeContent}}
<div id="readme_profile" class="render-content markup" data-profile-view-as-member="{{.IsViewingOrgAsMember}}">{{.ProfileReadmeContent}}</div> <div id="readme_profile" class="render-content markup" data-profile-view-as-member="{{.IsViewingOrgAsMember}}">{{.ProfileReadmeContent}}</div>
{{end}} {{end}}
{{template "shared/repo_search" .}} {{template "shared/repo/search" .}}
{{template "explore/repo_list" .}} {{template "shared/repo/list" .}}
{{template "base/paginate" .}} {{template "base/paginate" .}}
</div> </div>

View File

@ -1,20 +1,12 @@
{{template "base/head" .}} {{template "base/head" .}}
<div role="main" aria-label="{{.Title}}" class="page-content repository forks"> <div role="main" aria-label="{{.Title}}" class="page-content repository forks">
{{template "repo/header" .}} {{template "repo/header" .}}
<div class="ui container"> <div class="ui container fork-list">
<h2 class="ui dividing header"> <h2 class="ui dividing header">
{{ctx.Locale.Tr "repo.forks"}} {{ctx.Locale.Tr "repo.forks"}}
</h2> </h2>
<div class="flex-list"> {{template "shared/repo/list" .}}
{{range .Forks}} {{template "base/paginate" .}}
<div class="flex-item tw-border-0 repo-fork-item">
<span>{{ctx.AvatarUtils.Avatar .Owner}}</span>
<span><a href="{{.Owner.HomeLink}}">{{.Owner.Name}}</a> / <a href="{{.Link}}">{{.Name}}</a></span>
</div>
{{end}}
</div>
</div> </div>
{{template "base/paginate" .}}
</div> </div>
{{template "base/footer" .}} {{template "base/footer" .}}

View File

@ -2,12 +2,16 @@
{{range .Repos}} {{range .Repos}}
<div class="flex-item"> <div class="flex-item">
<div class="flex-item-leading"> <div class="flex-item-leading">
{{template "repo/icon" .}} {{if $.ShowRepoOwnerAvatar}}
{{ctx.AvatarUtils.Avatar .Owner 24}}
{{else}}
{{template "repo/icon" .}}
{{end}}
</div> </div>
<div class="flex-item-main"> <div class="flex-item-main">
<div class="flex-item-header"> <div class="flex-item-header">
<div class="flex-item-title"> <div class="flex-item-title">
{{if and (or $.PageIsExplore $.PageIsProfileStarList) .Owner}} {{if and $.ShowRepoOwnerOnList .Owner}}
<a class="text primary name" href="{{.Owner.HomeLink}}">{{.Owner.Name}}</a>/ <a class="text primary name" href="{{.Owner.HomeLink}}">{{.Owner.Name}}</a>/
{{end}} {{end}}
<a class="text primary name" href="{{.Link}}">{{.Name}}</a> <a class="text primary name" href="{{.Link}}">{{.Name}}</a>

View File

@ -69,8 +69,8 @@
{{template "shared/issuelist" dict "." . "listType" "dashboard"}} {{template "shared/issuelist" dict "." . "listType" "dashboard"}}
{{end}} {{end}}
{{else}} {{else}}
{{template "shared/repo_search" .}} {{template "shared/repo/search" .}}
{{template "explore/repo_list" .}} {{template "shared/repo/list" .}}
{{template "base/paginate" .}} {{template "base/paginate" .}}
{{end}} {{end}}
</div> </div>

View File

@ -17,8 +17,8 @@
{{template "user/dashboard/feeds" .}} {{template "user/dashboard/feeds" .}}
{{else if eq .TabName "stars"}} {{else if eq .TabName "stars"}}
<div class="stars"> <div class="stars">
{{template "shared/repo_search" .}} {{template "shared/repo/search" .}}
{{template "explore/repo_list" .}} {{template "shared/repo/list" .}}
{{template "base/paginate" .}} {{template "base/paginate" .}}
</div> </div>
{{else if eq .TabName "following"}} {{else if eq .TabName "following"}}
@ -30,8 +30,8 @@
{{else if eq .TabName "organizations"}} {{else if eq .TabName "organizations"}}
{{template "repo/user_cards" .}} {{template "repo/user_cards" .}}
{{else}} {{else}}
{{template "shared/repo_search" .}} {{template "shared/repo/search" .}}
{{template "explore/repo_list" .}} {{template "shared/repo/list" .}}
{{template "base/paginate" .}} {{template "base/paginate" .}}
{{end}} {{end}}
</div> </div>

View File

@ -84,7 +84,7 @@ func TestRepoForkToOrg(t *testing.T) {
func TestForkListLimitedAndPrivateRepos(t *testing.T) { func TestForkListLimitedAndPrivateRepos(t *testing.T) {
defer tests.PrepareTestEnv(t)() defer tests.PrepareTestEnv(t)()
forkItemSelector := ".repo-fork-item" forkItemSelector := ".fork-list .flex-item"
user1Sess := loginUser(t, "user1") user1Sess := loginUser(t, "user1")
user1 := unittest.AssertExistsAndLoadBean(t, &user_model.User{Name: "user1"}) user1 := unittest.AssertExistsAndLoadBean(t, &user_model.User{Name: "user1"})