Skip to content

refactor organization menu #33928

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 28 commits into from
Apr 10, 2025
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
8da4b0d
fix org style
ExplodingDragon Mar 18, 2025
b0e66a1
Add org check
ExplodingDragon Mar 19, 2025
9f9285a
cleanup
ExplodingDragon Mar 19, 2025
da24b32
Merge branch 'main' into fix-tmpl
ExplodingDragon Mar 20, 2025
ca09276
fix code page
ExplodingDragon Mar 20, 2025
3828f30
Merge branch 'main' into fix-tmpl
ExplodingDragon Mar 26, 2025
a07e862
Merge branch 'main' into fix-tmpl
ExplodingDragon Mar 28, 2025
f720550
Merge branch 'main' into fix-tmpl
ExplodingDragon Apr 6, 2025
f4091b9
Merge branch 'main' into fix-tmpl
ExplodingDragon Apr 8, 2025
f6d4698
rewrite
ExplodingDragon Apr 8, 2025
5164dc3
Merge branch 'main' into fix-tmpl
ExplodingDragon Apr 8, 2025
543683c
refactor v1: RenderUserHeader
ExplodingDragon Apr 8, 2025
2d9c4d7
refactor v2: LoadHeaderCount
ExplodingDragon Apr 8, 2025
f633723
cleanup & fix BlockedUsers
ExplodingDragon Apr 8, 2025
686b963
fix Packages tmpl
ExplodingDragon Apr 8, 2025
679181b
Merge branch 'main' into fix-tmpl
ExplodingDragon Apr 8, 2025
11a5510
cleanup
ExplodingDragon Apr 8, 2025
68ef8ee
cleanup
ExplodingDragon Apr 8, 2025
584cf85
fix oauth2 error
ExplodingDragon Apr 8, 2025
34d55af
clean up anything
ExplodingDragon Apr 8, 2025
9795384
fix typo
ExplodingDragon Apr 8, 2025
3066296
Merge branch 'main' into fix-tmpl
ExplodingDragon Apr 9, 2025
417c7fe
refactor
wxiaoguang Apr 9, 2025
0155ad1
Merge branch 'main' into fix-tmpl
ExplodingDragon Apr 9, 2025
6ef8d28
fix user profile readme, check time tracking
wxiaoguang Apr 9, 2025
4b4c157
fix project page (thanks @yp05327)
ExplodingDragon Apr 10, 2025
d279405
Merge branch 'main' into fix-tmpl
ExplodingDragon Apr 10, 2025
503a59f
Merge branch 'main' into fix-tmpl
GiteaBot Apr 10, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions routers/web/org/projects.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,13 @@ func Projects(ctx *context.Context) {

pager := context.NewPagination(int(total), setting.UI.IssuePagingNum, page, numPages)
pager.AddParamFromRequest(ctx.Req)

_, err = shared_user.PrepareOrgHeader(ctx)
if err != nil {
ctx.ServerError("PrepareOrgHeader", err)
return
}

ctx.Data["Page"] = pager

ctx.Data["CanWriteProjects"] = canWriteProjects(ctx)
Expand Down
8 changes: 8 additions & 0 deletions routers/web/org/worktime.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (

"code.gitea.io/gitea/models/organization"
"code.gitea.io/gitea/modules/templates"
shared_user "code.gitea.io/gitea/routers/web/shared/user"
"code.gitea.io/gitea/services/context"
)

Expand Down Expand Up @@ -69,6 +70,13 @@ func Worktime(ctx *context.Context) {
ctx.ServerError("GetWorktime", err)
return
}

_, err = shared_user.PrepareOrgHeader(ctx)
if err != nil {
ctx.ServerError("PrepareOrgHeader", err)
return
}

ctx.Data["WorktimeSumResult"] = worktimeSumResult
ctx.HTML(http.StatusOK, tplByRepos)
}
7 changes: 7 additions & 0 deletions routers/web/user/code.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ func CodeSearch(ctx *context.Context) {
ctx.ServerError("LoadHeaderCount", err)
return
}
if ctx.ContextUser.IsOrganization() {
_, err := shared_user.PrepareOrgHeader(ctx)
if err != nil {
ctx.ServerError("PrepareOrgHeader", err)
return
}
}

ctx.Data["IsPackageEnabled"] = setting.Packages.Enabled
ctx.Data["Title"] = ctx.Tr("explore.code")
Expand Down
13 changes: 12 additions & 1 deletion routers/web/user/package.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,11 @@ func ListPackages(ctx *context.Context) {
ctx.Data["IsOrganizationMember"] = false
ctx.Data["IsOrganizationOwner"] = false
}
_, err := shared_user.PrepareOrgHeader(ctx)
if err != nil {
ctx.ServerError("PrepareOrgHeader", err)
return
}
}

pager := context.NewPagination(int(total), setting.UI.PackagesPagingNum, page, 5)
Expand Down Expand Up @@ -428,7 +433,13 @@ func PackageSettings(ctx *context.Context) {
ctx.ServerError("LoadHeaderCount", err)
return
}

if ctx.ContextUser.IsOrganization() {
_, err = shared_user.PrepareOrgHeader(ctx)
if err != nil {
ctx.ServerError("PrepareOrgHeader", err)
return
}
}
ctx.HTML(http.StatusOK, tplPackagesSettings)
}

Expand Down