summaryrefslogtreecommitdiffstats
path: root/routers/user
diff options
context:
space:
mode:
authorBo-Yi Wu <appleboy.tw@gmail.com>2017-02-07 19:54:16 +0800
committerLunny Xiao <xiaolunwen@gmail.com>2017-02-07 19:54:16 +0800
commitb13232f52454b72c414e8bf686daccee712346e1 (patch)
treed83cba64b231aa17853cf9c135760847cb5b072f /routers/user
parentceae143e78dabe9c5ef6bafff739aa487f79ca70 (diff)
downloadgitea-b13232f52454b72c414e8bf686daccee712346e1.tar.gz
gitea-b13232f52454b72c414e8bf686daccee712346e1.zip
feat: support paginater on star tab of user profile. (#845)
Diffstat (limited to 'routers/user')
-rw-r--r--routers/user/profile.go19
1 files changed, 17 insertions, 2 deletions
diff --git a/routers/user/profile.go b/routers/user/profile.go
index ef6cb9cd9d..1f5acbec0d 100644
--- a/routers/user/profile.go
+++ b/routers/user/profile.go
@@ -97,12 +97,27 @@ func Profile(ctx *context.Context) {
return
}
case "stars":
- starredRepos, err := ctxUser.GetStarredRepos(showPrivate)
+ page := ctx.QueryInt("page")
+ if page <= 0 {
+ page = 1
+ }
+
+ repos, err := ctxUser.GetStarredRepos(showPrivate, page, setting.UI.User.RepoPagingNum, "")
if err != nil {
ctx.Handle(500, "GetStarredRepos", err)
return
}
- ctx.Data["Repos"] = starredRepos
+
+ counts, err := ctxUser.GetStarredRepoCount(showPrivate)
+ if err != nil {
+ ctx.Handle(500, "GetStarredRepoCount", err)
+ return
+ }
+
+ ctx.Data["Repos"] = repos
+ ctx.Data["Page"] = paginater.New(int(counts), setting.UI.User.RepoPagingNum, page, 5)
+ ctx.Data["Total"] = int(counts)
+ ctx.Data["Tabs"] = "stars"
default:
page := ctx.QueryInt("page")
if page <= 0 {