From 53215726e1e861bf47bd06200795dbf9b2556a3f Mon Sep 17 00:00:00 2001 From: 0ko <0ko@noreply.codeberg.org> Date: Tue, 18 Jun 2024 20:53:27 +0500 Subject: [PATCH] Add headers to follower lists --- options/locale/locale_en-US.ini | 4 + routers/web/user/profile.go | 2 + templates/repo/user_cards.tmpl | 6 +- .../integration/user_profile_follows_test.go | 132 ++++++++++++++++++ web_src/css/repo.css | 2 +- 5 files changed, 142 insertions(+), 4 deletions(-) create mode 100644 tests/integration/user_profile_follows_test.go diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index fda155644..051a44d95 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -655,6 +655,10 @@ change_avatar = Change your avatar… joined_on = Joined on %s repositories = Repositories activity = Public activity +followers.title.one = Follower +followers.title.few = Followers +following.title.one = Following +following.title.few = Following followers_one = %d follower followers_few = %d followers following_one = %d following diff --git a/routers/web/user/profile.go b/routers/web/user/profile.go index 64ce93b6c..a83d7f733 100644 --- a/routers/web/user/profile.go +++ b/routers/web/user/profile.go @@ -183,9 +183,11 @@ func prepareUserProfileTabData(ctx *context.Context, showPrivate bool, profileDb case "followers": ctx.Data["Cards"] = followers total = int(numFollowers) + ctx.Data["CardsTitle"] = ctx.TrN(total, "user.followers.title.one", "user.followers.title.few") case "following": ctx.Data["Cards"] = following total = int(numFollowing) + ctx.Data["CardsTitle"] = ctx.TrN(total, "user.following.title.one", "user.following.title.few") case "activity": date := ctx.FormString("date") pagingNum = setting.UI.FeedPagingNum diff --git a/templates/repo/user_cards.tmpl b/templates/repo/user_cards.tmpl index 5accc2c7a..9061b1771 100644 --- a/templates/repo/user_cards.tmpl +++ b/templates/repo/user_cards.tmpl @@ -1,8 +1,8 @@
{{if .CardsTitle}} -

- {{.CardsTitle}} -

+

+ {{.CardsTitle}} +

{{end}}