summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakobDev <jakobdev@gmx.de>2023-04-24 18:28:37 +0200
committerGitHub <noreply@github.com>2023-04-24 12:28:37 -0400
commitd347208114966166ffa9655adc5b202676546c31 (patch)
tree88728614aaa449f691e3c8ab36d18f617f56a0f8
parent017a156553770278e3000532f8b32bdbd6e5ecc5 (diff)
downloadgitea-d347208114966166ffa9655adc5b202676546c31.tar.gz
gitea-d347208114966166ffa9655adc5b202676546c31.zip
Improve External Wiki in Repo Header (#24304)
If you use a External Wiki, with Gitea, it brings currently 2 Problems in the Header: 1. It always uses the Wiki Icon. When you use e.g. a External Issue Tracker, it shows the External Link icon to Indicate, that the User will send to a External Side. This helps preventing fishing. 2. If you use a External Wiki, the Link in the Header still goes to `{repo}/wiki` which will redirect the user to the External Wiki. That means, that if the users hovers with the Cursor over the link, it shows `{repo}/wiki`, so the User does not know, where he will land. This PR fixes both. ![grafik](https://user-images.githubusercontent.com/15185051/233964455-dbca9bbe-a224-44c5-b351-5649fd9b15fc.png)
-rw-r--r--templates/repo/header.tmpl10
1 files changed, 8 insertions, 2 deletions
diff --git a/templates/repo/header.tmpl b/templates/repo/header.tmpl
index 5f2e135b98..8a6833f499 100644
--- a/templates/repo/header.tmpl
+++ b/templates/repo/header.tmpl
@@ -215,12 +215,18 @@
</a>
{{end}}
- {{if or (.Permission.CanRead $.UnitTypeWiki) (.Permission.CanRead $.UnitTypeExternalWiki)}}
- <a class="{{if .PageIsWiki}}active {{end}}item" href="{{.RepoLink}}/wiki" {{if and (.Permission.CanRead $.UnitTypeExternalWiki) (not (StringUtils.HasPrefix ((.Repository.MustGetUnit $.Context $.UnitTypeExternalWiki).ExternalWikiConfig.ExternalWikiURL) (.Repository.Link)))}} target="_blank" rel="noopener noreferrer" {{end}}>
+ {{if .Permission.CanRead $.UnitTypeWiki}}
+ <a class="{{if .PageIsWiki}}active {{end}}item" href="{{.RepoLink}}/wiki">
{{svg "octicon-book"}} {{.locale.Tr "repo.wiki"}}
</a>
{{end}}
+ {{if .Permission.CanRead $.UnitTypeExternalWiki}}
+ <a class="item" href="{{(.Repository.MustGetUnit $.Context $.UnitTypeExternalWiki).ExternalWikiConfig.ExternalWikiURL}}" target="_blank" rel="noopener noreferrer">
+ {{svg "octicon-link-external"}} {{.locale.Tr "repo.wiki"}}
+ </a>
+ {{end}}
+
{{if and (.Permission.CanReadAny $.UnitTypePullRequests $.UnitTypeIssues $.UnitTypeReleases) (not .IsEmptyRepo)}}
<a class="{{if .PageIsActivity}}active {{end}}item" href="{{.RepoLink}}/activity">
{{svg "octicon-pulse"}} {{.locale.Tr "repo.activity"}}