2024-02-27 23:38:16 +05:30
|
|
|
{{with .Repository}}
|
2024-02-25 16:28:23 +05:30
|
|
|
{{if and (not .IsEmpty) ($.Permission.CanRead $.UnitTypeCode)}}
|
|
|
|
<div class="ui labeled button
|
|
|
|
{{if or (not $.IsSigned) (and (not $.CanSignedUserFork) (not $.UserAndOrgForks))}}
|
|
|
|
disabled
|
|
|
|
{{end}}"
|
|
|
|
{{if not $.IsSigned}}
|
|
|
|
data-tooltip-content="{{ctx.Locale.Tr "repo.fork_guest_user"}}"
|
|
|
|
{{else if and (not $.CanSignedUserFork) (not $.UserAndOrgForks)}}
|
|
|
|
data-tooltip-content="{{ctx.Locale.Tr "repo.fork_from_self"}}"
|
|
|
|
{{end}}
|
|
|
|
>
|
|
|
|
<a class="ui compact{{if $.ShowForkModal}} show-modal{{end}} small basic button"
|
|
|
|
{{if not $.CanSignedUserFork}}
|
|
|
|
{{if gt (len $.UserAndOrgForks) 1}}
|
2024-03-21 22:34:03 +05:30
|
|
|
href="#" data-modal="#fork-repo-modal"
|
2024-02-25 16:28:23 +05:30
|
|
|
{{else if eq (len $.UserAndOrgForks) 1}}
|
|
|
|
href="{{AppSubUrl}}/{{(index $.UserAndOrgForks 0).FullName}}"
|
|
|
|
{{/*else is not required here, because the button shouldn't link to any site if you can't create a fork*/}}
|
|
|
|
{{end}}
|
|
|
|
{{else if not $.UserAndOrgForks}}
|
|
|
|
href="{{$.RepoLink}}/fork"
|
|
|
|
{{else}}
|
2024-03-21 22:34:03 +05:30
|
|
|
href="#" data-modal="#fork-repo-modal"
|
2024-02-25 16:28:23 +05:30
|
|
|
{{end}}
|
|
|
|
>
|
2024-03-21 22:34:03 +05:30
|
|
|
{{svg "octicon-repo-forked"}}<span class="text not-mobile">{{ctx.Locale.Tr "repo.fork"}}</span>
|
2024-02-25 16:28:23 +05:30
|
|
|
</a>
|
|
|
|
<div class="ui small modal" id="fork-repo-modal">
|
|
|
|
<div class="header">
|
|
|
|
{{ctx.Locale.Tr "repo.already_forked" .Name}}
|
|
|
|
</div>
|
2024-03-04 09:03:20 +05:30
|
|
|
<div class="content tw-text-left">
|
2024-02-25 16:28:23 +05:30
|
|
|
<div class="ui list">
|
|
|
|
{{range $.UserAndOrgForks}}
|
|
|
|
<div class="ui item gt-py-3">
|
|
|
|
<a href="{{.Link}}">{{svg "octicon-repo-forked" 16 "gt-mr-3"}}{{.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>
|
|
|
|
<a class="ui basic label" href="{{.Link}}/forks">
|
|
|
|
{{CountFmt .NumForks}}
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
{{end}}
|
2024-02-27 23:38:16 +05:30
|
|
|
{{end}}
|