mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-31 11:52:10 +00:00
#1692 APIs: Users Followers
- User profile un/follow - List user's followers/following
This commit is contained in:
parent
c62a6b7a12
commit
a49af93faf
27 changed files with 641 additions and 271 deletions
|
@ -217,7 +217,7 @@ func Home(ctx *middleware.Context) {
|
|||
ctx.HTML(200, HOME)
|
||||
}
|
||||
|
||||
func renderItems(ctx *middleware.Context, total int, getter func(page int) ([]*models.User, error)) {
|
||||
func RenderUserCards(ctx *middleware.Context, total int, getter func(page int) ([]*models.User, error), tpl base.TplName) {
|
||||
page := ctx.QueryInt("page")
|
||||
if page <= 0 {
|
||||
page = 1
|
||||
|
@ -230,21 +230,23 @@ func renderItems(ctx *middleware.Context, total int, getter func(page int) ([]*m
|
|||
ctx.Handle(500, "getter", err)
|
||||
return
|
||||
}
|
||||
ctx.Data["Watchers"] = items
|
||||
ctx.Data["Cards"] = items
|
||||
|
||||
ctx.HTML(200, WATCHERS)
|
||||
ctx.HTML(200, tpl)
|
||||
}
|
||||
|
||||
func Watchers(ctx *middleware.Context) {
|
||||
ctx.Data["Title"] = ctx.Tr("repo.watchers")
|
||||
ctx.Data["CardsTitle"] = ctx.Tr("repo.watchers")
|
||||
ctx.Data["PageIsWatchers"] = true
|
||||
renderItems(ctx, ctx.Repo.Repository.NumWatches, ctx.Repo.Repository.GetWatchers)
|
||||
RenderUserCards(ctx, ctx.Repo.Repository.NumWatches, ctx.Repo.Repository.GetWatchers, WATCHERS)
|
||||
}
|
||||
|
||||
func Stars(ctx *middleware.Context) {
|
||||
ctx.Data["Title"] = ctx.Tr("repo.stargazers")
|
||||
ctx.Data["CardsTitle"] = ctx.Tr("repo.stargazers")
|
||||
ctx.Data["PageIsStargazers"] = true
|
||||
renderItems(ctx, ctx.Repo.Repository.NumStars, ctx.Repo.Repository.GetStargazers)
|
||||
RenderUserCards(ctx, ctx.Repo.Repository.NumStars, ctx.Repo.Repository.GetStargazers, WATCHERS)
|
||||
}
|
||||
|
||||
func Forks(ctx *middleware.Context) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue