mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-27 04:07:08 +00:00
parent
40dc458bb6
commit
fcbac38d6f
21 changed files with 165 additions and 196 deletions
|
@ -10,8 +10,6 @@ import (
|
|||
"path"
|
||||
"strings"
|
||||
|
||||
"github.com/Unknwon/paginater"
|
||||
|
||||
"code.gitea.io/gitea/models"
|
||||
"code.gitea.io/gitea/modules/base"
|
||||
"code.gitea.io/gitea/modules/context"
|
||||
|
@ -127,6 +125,7 @@ func Profile(ctx *context.Context) {
|
|||
var (
|
||||
repos []*models.Repository
|
||||
count int64
|
||||
total int
|
||||
orderBy models.SearchOrderBy
|
||||
)
|
||||
|
||||
|
@ -201,18 +200,14 @@ func Profile(ctx *context.Context) {
|
|||
}
|
||||
}
|
||||
|
||||
ctx.Data["Repos"] = repos
|
||||
ctx.Data["Page"] = paginater.New(int(count), setting.UI.User.RepoPagingNum, page, 5)
|
||||
ctx.Data["Total"] = count
|
||||
total = int(count)
|
||||
default:
|
||||
if len(keyword) == 0 {
|
||||
var total int
|
||||
repos, err = models.GetUserRepositories(ctxUser.ID, showPrivate, page, setting.UI.User.RepoPagingNum, orderBy.String())
|
||||
if err != nil {
|
||||
ctx.ServerError("GetRepositories", err)
|
||||
return
|
||||
}
|
||||
ctx.Data["Repos"] = repos
|
||||
|
||||
if showPrivate {
|
||||
total = ctxUser.NumRepos
|
||||
|
@ -224,9 +219,6 @@ func Profile(ctx *context.Context) {
|
|||
}
|
||||
total = int(count)
|
||||
}
|
||||
|
||||
ctx.Data["Page"] = paginater.New(total, setting.UI.User.RepoPagingNum, page, 5)
|
||||
ctx.Data["Total"] = total
|
||||
} else {
|
||||
repos, count, err = models.SearchRepositoryByName(&models.SearchRepoOptions{
|
||||
Keyword: keyword,
|
||||
|
@ -244,11 +236,15 @@ func Profile(ctx *context.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
ctx.Data["Repos"] = repos
|
||||
ctx.Data["Page"] = paginater.New(int(count), setting.UI.User.RepoPagingNum, page, 5)
|
||||
ctx.Data["Total"] = count
|
||||
total = int(count)
|
||||
}
|
||||
}
|
||||
ctx.Data["Repos"] = repos
|
||||
ctx.Data["Total"] = total
|
||||
|
||||
pager := context.NewPagination(total, setting.UI.User.RepoPagingNum, page, 5)
|
||||
pager.SetDefaultParams(ctx)
|
||||
ctx.Data["Page"] = pager
|
||||
|
||||
ctx.Data["ShowUserEmail"] = len(ctxUser.Email) > 0 && ctx.IsSigned && (!ctxUser.KeepEmailPrivate || ctxUser.ID == ctx.User.ID)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue