Files
Gitea/templates/repo/header/fork.tmpl
T
Giteabot 94a2c3ec18 chore(deps): update dependencies (#38660)
Signed-off-by: silverwind <me@silverwind.io>
Co-authored-by: silverwind <me@silverwind.io>
2026-07-27 16:55:27 +00:00

46 lines
1.6 KiB
Handlebars

{{$canNotForkOwn := and $.IsSigned (not $.CanSignedUserFork) (not $.UserAndOrgForks)}}
{{$forkHref := printf "%s/fork" $.RepoLink}}
{{if not $.IsSigned}}
{{$forkHref = printf "%s/user/login" AppSubUrl}}
{{else if $.ShowForkModal}}{{/* see backend comment for this logic */}}
{{$forkHref = "#"}}
{{else if eq (len $.UserAndOrgForks) 1}}
{{$forkHref = printf "%s/%s" AppSubUrl (index $.UserAndOrgForks 0).FullName}}
{{else if $canNotForkOwn}}
{{$forkHref = "#"}}
{{end}}
<div class="ui labeled button"
{{if not $.IsSigned}}
data-tooltip-content="{{ctx.Locale.Tr "repo.fork_guest_user"}}"
{{else if $canNotForkOwn}}
data-tooltip-content="{{ctx.Locale.Tr "repo.fork_from_self"}}"
{{end}}
>
<a role="button" class="ui compact small basic button {{if $.ShowForkModal}}show-modal{{end}}" href="{{$forkHref}}"{{if and $.IsSigned $.ShowForkModal}} data-modal="#fork-repo-modal"{{end}}>
{{svg "octicon-repo-forked"}}<span class="text not-mobile">{{ctx.Locale.Tr "repo.fork"}}</span>
</a>
<a class="ui basic label" href="{{$.Repository.Link}}/forks">
{{CountFmt $.Repository.NumForks}}
</a>
</div>
{{if $.ShowForkModal}}
<div class="ui small modal" id="fork-repo-modal">
<div class="header">
{{ctx.Locale.Tr "repo.already_forked" $.Repository.Name}}
</div>
<div class="content">
<div class="ui relaxed list">
{{range $.UserAndOrgForks}}
<div class="item">
<a class="flex-text-block" href="{{.Link}}">{{svg "octicon-repo-forked"}}{{.FullName}}</a>
</div>
{{end}}
</div>
{{if $.CanSignedUserFork}}
<div class="divider"></div>
<a href="{{$.RepoLink}}/fork">{{ctx.Locale.Tr "repo.fork_to_different_account"}}</a>
{{end}}
</div>
</div>
{{end}}