mirror of https://github.com/go-gitea/gitea.git
Merge fd5cc7dfca into 01351cc6c7
commit
365cfb3676
@ -1,10 +1,20 @@
|
|||||||
{{$avatarLink := (.RelAvatarLink ctx)}}
|
{{/* Template Attributes:
|
||||||
{{if $avatarLink}}
|
* Repo (string, required): The repo
|
||||||
<img class="ui avatar tw-align-middle" src="{{$avatarLink}}" width="24" height="24" alt aria-hidden="true">
|
* Size (int, required): Icon size in pixels
|
||||||
{{else if $.IsMirror}}
|
* ShowRepoAvatar (boolean, optional): Render the repo's avatar, if one is set
|
||||||
{{svg "octicon-mirror" 24}}
|
* ShowRepoOwnerAvatar (boolean, optional): Render the repo's owner avatar
|
||||||
{{else if $.IsFork}}
|
*
|
||||||
{{svg "octicon-repo-forked" 24}}
|
* Note: Keep the icon logic in sync with web_src/js/utils/mappings.ts
|
||||||
|
*/}}
|
||||||
|
{{$avatarLink := (.Repo.RelAvatarLink ctx)}}
|
||||||
|
{{if .ShowRepoOwnerAvatar}}
|
||||||
|
{{ctx.AvatarUtils.Avatar .Repo.Owner .Size}}
|
||||||
|
{{else if and $avatarLink .ShowRepoAvatar}}
|
||||||
|
<img class="ui avatar tw-align-middle" src="{{$avatarLink}}" width="{{.Size}}" height="{{.Size}}" alt aria-hidden="true">
|
||||||
|
{{else if .Repo.IsMirror}}
|
||||||
|
{{svg "octicon-mirror" .Size}}
|
||||||
|
{{else if .Repo.IsFork}}
|
||||||
|
{{svg "octicon-repo-forked" .Size}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{svg "octicon-repo" 24}}
|
{{svg "octicon-repo" .Size}}
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|||||||
@ -0,0 +1,10 @@
|
|||||||
|
// repo icon, keep in sync with templates/repo/icon.tmpl
|
||||||
|
export function getRepoIcon(repo: Record<string, any>) {
|
||||||
|
if (repo.mirror) {
|
||||||
|
return 'octicon-mirror';
|
||||||
|
} else if (repo.fork) {
|
||||||
|
return 'octicon-repo-forked';
|
||||||
|
} else {
|
||||||
|
return 'octicon-repo';
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue