Fix the settings tab highlighting

When visiting a repos `/settings/units` page, highlight the active tab
properly: "Add more..." if the tab is displayed, or "Settings"
otherwise.

Fixes #3188.

Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
(cherry picked from commit 65ed86e396)
This commit is contained in:
Gergely Nagy 2024-04-12 19:11:21 +02:00 committed by GitHub
parent 89d751ef1b
commit fd5abfd244
2 changed files with 96 additions and 1 deletions

View file

@ -174,12 +174,14 @@
{{end}}
{{if .Permission.IsAdmin}}
{{$highlightSettings := true}}
{{if and .SignedUser.EnableRepoUnitHints (not (.Repository.AllUnitsEnabled ctx))}}
{{$highlightSettings = false}}
<a class="{{if .PageIsRepoSettingsUnits}}active {{end}}item" href="{{.RepoLink}}/settings/units">
{{svg "octicon-diff-added"}} {{ctx.Locale.Tr "repo.settings.units.add_more"}}
</a>
{{end}}
<a class="{{if and .PageIsRepoSettings (not .PageIsRepoSettingsUnits)}}active {{end}} item" href="{{.RepoLink}}/settings">
<a class="{{if and .PageIsRepoSettings (or $highlightSettings (not .PageIsRepoSettingsUnits))}}active {{end}} item" href="{{.RepoLink}}/settings">
{{svg "octicon-tools"}} {{ctx.Locale.Tr "repo.settings"}}
</a>
{{end}}