2024-02-27 19:08:16 +01:00
{{ with .Repository }}
2024-02-25 11:58:23 +01:00
{{ 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-22 01:04:03 +08:00
href="#" data-modal="#fork-repo-modal"
2024-02-25 11:58:23 +01:00
{{ 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-22 01:04:03 +08:00
href="#" data-modal="#fork-repo-modal"
2024-02-25 11:58:23 +01:00
{{ end }}
>
2024-03-22 01:04:03 +08:00
{{ svg "octicon-repo-forked" }} < span class = "text not-mobile" > {{ ctx .Locale.Tr "repo.fork" }} </ span >
2024-02-25 11:58:23 +01:00
< / a >
< div class = "ui small modal" id = "fork-repo-modal" >
< div class = "header" >
{{ ctx .Locale.Tr "repo.already_forked" .Name }}
< / div >
2024-03-04 04:33:20 +01:00
< div class = "content tw-text-left" >
2024-02-25 11:58:23 +01:00
< 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 19:08:16 +01:00
{{ end }}