diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2024-06-18 08:51:13 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-18 00:51:13 +0000 |
commit | 37a4b233a0a4ca516b90e0c8e15d8dafb8d13358 (patch) | |
tree | 906fc88c06e46d164157707886833332aebcf5c8 /templates/user | |
parent | d32648b204395fe3590ca2de5f38f0f97da510aa (diff) | |
download | gitea-37a4b233a0a4ca516b90e0c8e15d8dafb8d13358.tar.gz gitea-37a4b233a0a4ca516b90e0c8e15d8dafb8d13358.zip |
Refactor repo unit "disabled" check (#31389)
1. There are already global "unit consts", no need to use context data, which is fragile
2. Remove the "String()" method from "unit", it would only cause rendering problems in templates
---------
Co-authored-by: silverwind <me@silverwind.io>
Diffstat (limited to 'templates/user')
-rw-r--r-- | templates/user/dashboard/navbar.tmpl | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/templates/user/dashboard/navbar.tmpl b/templates/user/dashboard/navbar.tmpl index 464228289e..7982cbd950 100644 --- a/templates/user/dashboard/navbar.tmpl +++ b/templates/user/dashboard/navbar.tmpl @@ -81,17 +81,17 @@ <a class="{{if .PageIsNews}}active {{end}}item tw-ml-auto" href="{{.ContextUser.DashboardLink}}{{if .Team}}/{{PathEscape .Team.Name}}{{end}}"> {{svg "octicon-rss"}} {{ctx.Locale.Tr "activities"}} </a> - {{if not .UnitIssuesGlobalDisabled}} + {{if not ctx.Consts.RepoUnitTypeIssues.UnitGlobalDisabled}} <a class="{{if .PageIsIssues}}active {{end}}item" href="{{.ContextUser.OrganisationLink}}/issues{{if .Team}}/{{PathEscape .Team.Name}}{{end}}"> {{svg "octicon-issue-opened"}} {{ctx.Locale.Tr "issues"}} </a> {{end}} - {{if not .UnitPullsGlobalDisabled}} + {{if not ctx.Consts.RepoUnitTypePullRequests.UnitGlobalDisabled}} <a class="{{if .PageIsPulls}}active {{end}}item" href="{{.ContextUser.OrganisationLink}}/pulls{{if .Team}}/{{PathEscape .Team.Name}}{{end}}"> {{svg "octicon-git-pull-request"}} {{ctx.Locale.Tr "pull_requests"}} </a> {{end}} - {{if and .ShowMilestonesDashboardPage (not (and .UnitIssuesGlobalDisabled .UnitPullsGlobalDisabled))}} + {{if and .ShowMilestonesDashboardPage (not (and ctx.Consts.RepoUnitTypeIssues.UnitGlobalDisabled ctx.Consts.RepoUnitTypePullRequests.UnitGlobalDisabled))}} <a class="{{if .PageIsMilestonesDashboard}}active {{end}}item" href="{{.ContextUser.OrganisationLink}}/milestones{{if .Team}}/{{PathEscape .Team.Name}}{{end}}"> {{svg "octicon-milestone"}} {{ctx.Locale.Tr "milestones"}} </a> |