Skip to content

Commit d347208

Browse files
authored
Improve External Uncyclo in Repo Header (#24304)
If you use a External Uncyclo, with Gitea, it brings currently 2 Problems in the Header: 1. It always uses the Uncyclo 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 Uncyclo, the Link in the Header still goes to `{repo}/wiki` which will redirect the user to the External Uncyclo. 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)
1 parent 017a156 commit d347208

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

templates/repo/header.tmpl

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,12 +215,18 @@
215215
</a>
216216
{{end}}
217217

218-
{{if or (.Permission.CanRead $.UnitTypeUncyclo) (.Permission.CanRead $.UnitTypeExternalUncyclo)}}
219-
<a class="{{if .PageIsUncyclo}}active {{end}}item" href="{{.RepoLink}}/wiki" {{if and (.Permission.CanRead $.UnitTypeExternalUncyclo) (not (StringUtils.HasPrefix ((.Repository.MustGetUnit $.Context $.UnitTypeExternalUncyclo).ExternalUncycloConfig.ExternalUncycloURL) (.Repository.Link)))}} target="_blank" rel="noopener noreferrer" {{end}}>
218+
{{if .Permission.CanRead $.UnitTypeUncyclo}}
219+
<a class="{{if .PageIsUncyclo}}active {{end}}item" href="{{.RepoLink}}/wiki">
220220
{{svg "octicon-book"}} {{.locale.Tr "repo.wiki"}}
221221
</a>
222222
{{end}}
223223

224+
{{if .Permission.CanRead $.UnitTypeExternalUncyclo}}
225+
<a class="item" href="{{(.Repository.MustGetUnit $.Context $.UnitTypeExternalUncyclo).ExternalUncycloConfig.ExternalUncycloURL}}" target="_blank" rel="noopener noreferrer">
226+
{{svg "octicon-link-external"}} {{.locale.Tr "repo.wiki"}}
227+
</a>
228+
{{end}}
229+
224230
{{if and (.Permission.CanReadAny $.UnitTypePullRequests $.UnitTypeIssues $.UnitTypeReleases) (not .IsEmptyRepo)}}
225231
<a class="{{if .PageIsActivity}}active {{end}}item" href="{{.RepoLink}}/activity">
226232
{{svg "octicon-pulse"}} {{.locale.Tr "repo.activity"}}

0 commit comments

Comments
 (0)