Skip to content

Commit b6adf80

Browse files
authored
Fix repo internal icon when avatar is present (#11873)
* Fix repo internal icon when avatar is present * fix tabs * move repo icons in header to separate template
1 parent 83e9ac5 commit b6adf80

File tree

2 files changed

+25
-38
lines changed

2 files changed

+25
-38
lines changed

templates/repo/header.tmpl

Lines changed: 2 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -5,50 +5,14 @@
55
<div class="ui huge breadcrumb repo-title">
66
{{if .RelAvatarLink}}
77
<img class="ui avatar image" src="{{.RelAvatarLink}}">
8-
{{else if .IsTemplate}}
9-
{{if .IsPrivate}}
10-
{{svg "octicon-repo-template-private" 32}}
11-
{{else}}
12-
{{svg "octicon-repo-template" 32}}
13-
{{end}}
148
{{else}}
15-
{{if .IsPrivate}}
16-
{{svg "octicon-lock" 32}}
17-
{{else if and (not .IsMirror) (not .IsFork) (.Owner)}}
18-
{{if .Owner.Visibility.IsPrivate}}
19-
{{svg "octicon-internal-repo" 32}}
20-
{{else}}
21-
{{svg "octicon-repo" 32}}
22-
{{end}}
23-
{{else if .IsMirror}}
24-
{{svg "octicon-repo-clone" 32}}
25-
{{else if .IsFork}}
26-
{{svg "octicon-repo-forked" 32}}
27-
{{else}}
28-
{{svg "octicon-repo" 32}}
29-
{{end}}
9+
{{template "repo/header_icon" .}}
3010
{{end}}
3111
<a href="{{AppSubUrl}}/{{.Owner.Name}}">{{.Owner.Name}}</a>
3212
<div class="divider"> / </div>
3313
<a href="{{$.RepoLink}}">{{.Name}}</a>
3414
{{if .RelAvatarLink}}
35-
{{if .IsTemplate}}
36-
{{if .IsPrivate}}
37-
{{svg "octicon-repo-template-private" 32}}
38-
{{else}}
39-
{{svg "octicon-repo-template" 32}}
40-
{{end}}
41-
{{else}}
42-
{{if .IsPrivate}}
43-
{{svg "octicon-lock" 32}}
44-
{{else if .IsMirror}}
45-
{{svg "octicon-repo-clone" 32}}
46-
{{else if .IsFork}}
47-
{{svg "octicon-repo-forked" 32}}
48-
{{else}}
49-
{{svg "octicon-repo" 32}}
50-
{{end}}
51-
{{end}}
15+
{{template "repo/header_icon" .}}
5216
{{end}}
5317
{{if .IsArchived}}<i class="archive icon archived-icon"></i>{{end}}
5418
{{if .IsMirror}}<div class="fork-flag">{{$.i18n.Tr "repo.mirror_from"}} <a target="_blank" rel="noopener noreferrer" href="{{if .SanitizedOriginalURL}}{{.SanitizedOriginalURL}}{{else}}{{MirrorAddress $.Mirror}}{{end}}">{{if .SanitizedOriginalURL}}{{.SanitizedOriginalURL}}{{else}}{{MirrorAddress $.Mirror}}{{end}}</a></div>{{end}}

templates/repo/header_icon.tmpl

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{{if $.IsTemplate}}
2+
{{if $.IsPrivate}}
3+
{{svg "octicon-repo-template-private" 32}}
4+
{{else}}
5+
{{svg "octicon-repo-template" 32}}
6+
{{end}}
7+
{{else}}
8+
{{if $.IsPrivate}}
9+
{{svg "octicon-lock" 32}}
10+
{{else if and (not $.IsMirror) (not $.IsFork) ($.Owner)}}
11+
{{if $.Owner.Visibility.IsPrivate}}
12+
{{svg "octicon-internal-repo" 32}}
13+
{{else}}
14+
{{svg "octicon-repo" 32}}
15+
{{end}}
16+
{{else if $.IsMirror}}
17+
{{svg "octicon-repo-clone" 32}}
18+
{{else if $.IsFork}}
19+
{{svg "octicon-repo-forked" 32}}
20+
{{else}}
21+
{{svg "octicon-repo" 32}}
22+
{{end}}
23+
{{end}}

0 commit comments

Comments
 (0)