mirror of
https://github.com/go-gitea/gitea.git
synced 2025-07-03 00:01:21 -04:00
Compare commits
4 Commits
80ce48bef2
...
9f75b9a1a4
Author | SHA1 | Date | |
---|---|---|---|
|
9f75b9a1a4 | ||
|
6fe5c4c4d9 | ||
|
29f084e495 | ||
|
d171273fd1 |
@ -62,6 +62,7 @@ func Projects(ctx *context.Context) {
|
||||
keyword := ctx.FormTrim("q")
|
||||
repo := ctx.Repo.Repository
|
||||
page := max(ctx.FormInt("page"), 1)
|
||||
ownerID := repo.OwnerID
|
||||
|
||||
ctx.Data["OpenCount"] = repo.NumOpenProjects
|
||||
ctx.Data["ClosedCount"] = repo.NumClosedProjects
|
||||
@ -73,21 +74,70 @@ func Projects(ctx *context.Context) {
|
||||
total = repo.NumClosedProjects
|
||||
}
|
||||
|
||||
projects, count, err := db.FindAndCount[project_model.Project](ctx, project_model.SearchOptions{
|
||||
projects := make([]*project_model.Project, 0, total)
|
||||
|
||||
repoProjects, count, err := db.FindAndCount[project_model.Project](ctx, project_model.SearchOptions{
|
||||
ListOptions: db.ListOptions{
|
||||
PageSize: setting.UI.IssuePagingNum,
|
||||
Page: page,
|
||||
},
|
||||
RepoID: repo.ID,
|
||||
IsClosed: optional.Some(isShowClosed),
|
||||
OrderBy: project_model.GetSearchOrderByBySortType(sortType),
|
||||
Type: project_model.TypeRepository,
|
||||
Title: keyword,
|
||||
})
|
||||
if err != nil {
|
||||
ctx.ServerError("GetProjects", err)
|
||||
ctx.ServerError("GetRepoProjects", err)
|
||||
return
|
||||
}
|
||||
projects = append(projects, repoProjects...)
|
||||
|
||||
openOrgProjects, openCountForOrgProjects, err := db.FindAndCount[project_model.Project](ctx, project_model.SearchOptions{
|
||||
ListOptions: db.ListOptions{
|
||||
PageSize: setting.UI.IssuePagingNum,
|
||||
Page: page,
|
||||
},
|
||||
OwnerID: ownerID,
|
||||
IsClosed: optional.Some(false),
|
||||
OrderBy: project_model.GetSearchOrderByBySortType(sortType),
|
||||
Type: project_model.TypeOrganization,
|
||||
Title: keyword,
|
||||
})
|
||||
if err != nil {
|
||||
ctx.ServerError("GetOrgProjects", err)
|
||||
return
|
||||
}
|
||||
|
||||
closeOrgProjects, closeCountForOrgProjects, err := db.FindAndCount[project_model.Project](ctx, project_model.SearchOptions{
|
||||
ListOptions: db.ListOptions{
|
||||
PageSize: setting.UI.IssuePagingNum,
|
||||
Page: page,
|
||||
},
|
||||
OwnerID: ownerID,
|
||||
IsClosed: optional.Some(true),
|
||||
OrderBy: project_model.GetSearchOrderByBySortType(sortType),
|
||||
Type: project_model.TypeOrganization,
|
||||
Title: keyword,
|
||||
})
|
||||
if err != nil {
|
||||
ctx.ServerError("GetOrgProjects", err)
|
||||
return
|
||||
}
|
||||
|
||||
if isShowClosed {
|
||||
count += closeCountForOrgProjects
|
||||
total += int(closeCountForOrgProjects)
|
||||
projects = append(projects, closeOrgProjects...)
|
||||
} else {
|
||||
count += openCountForOrgProjects
|
||||
total += int(openCountForOrgProjects)
|
||||
projects = append(projects, openOrgProjects...)
|
||||
}
|
||||
|
||||
totalOpenCount := repo.NumOpenProjects + int(openCountForOrgProjects)
|
||||
totalCloseCount := repo.NumClosedProjects + int(closeCountForOrgProjects)
|
||||
ctx.Data["OpenCount"] = totalOpenCount
|
||||
ctx.Data["ClosedCount"] = totalCloseCount
|
||||
|
||||
if err := project_service.LoadIssueNumbersForProjects(ctx, projects, ctx.Doer); err != nil {
|
||||
ctx.ServerError("LoadIssueNumbersForProjects", err)
|
||||
|
@ -29,7 +29,7 @@ export default {
|
||||
important: true, // the frameworks are mixed together, so tailwind needs to override other framework's styles
|
||||
content: [
|
||||
isProduction && '!./templates/devtest/**/*',
|
||||
isProduction && '!./web_src/js/standalone/devtest.js',
|
||||
isProduction && '!./web_src/js/standalone/devtest.ts',
|
||||
'!./templates/swagger/v1_json.tmpl',
|
||||
'!./templates/user/auth/oidc_wellknown.tmpl',
|
||||
'!**/*_test.go',
|
||||
|
Loading…
x
Reference in New Issue
Block a user