diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-10-11 10:27:00 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-10-11 10:27:00 +0000 |
commit | 65aa53fc52ff15efe54df4147564828d535837f8 (patch) | |
tree | 31c51dad04fdcca80e6d3043c8bd49d2f1a51f83 /templates/repo/header_fork.tmpl | |
parent | Initial commit. (diff) | |
download | forgejo-upstream.tar.xz forgejo-upstream.zip |
Adding upstream version 8.0.3.HEADupstream/8.0.3upstreamdebian
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'templates/repo/header_fork.tmpl')
-rw-r--r-- | templates/repo/header_fork.tmpl | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/templates/repo/header_fork.tmpl b/templates/repo/header_fork.tmpl new file mode 100644 index 00000000..de83000e --- /dev/null +++ b/templates/repo/header_fork.tmpl @@ -0,0 +1,52 @@ +{{with .Repository}} +{{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}} + href="#" data-modal="#fork-repo-modal" + {{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}} + href="#" data-modal="#fork-repo-modal" + {{end}} + > + {{svg "octicon-repo-forked"}}<span class="text not-mobile">{{ctx.Locale.Tr "repo.fork"}}</span> + </a> + <div class="ui small modal" id="fork-repo-modal"> + <div class="header"> + {{ctx.Locale.Tr "repo.already_forked" .Name}} + </div> + <div class="content tw-text-left"> + <div class="ui list"> + {{range $.UserAndOrgForks}} + <div class="ui item tw-py-2"> + <a href="{{.Link}}">{{svg "octicon-repo-forked" 16 "tw-mr-2"}}{{.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}} +{{end}} |