diff options
author | Daniel Baumann <daniel@debian.org> | 2024-10-18 20:33:49 +0200 |
---|---|---|
committer | Daniel Baumann <daniel@debian.org> | 2024-12-12 23:57:56 +0100 |
commit | e68b9d00a6e05b3a941f63ffb696f91e554ac5ec (patch) | |
tree | 97775d6c13b0f416af55314eb6a89ef792474615 /templates/repo/header_fork.tmpl | |
parent | Initial commit. (diff) | |
download | forgejo-e68b9d00a6e05b3a941f63ffb696f91e554ac5ec.tar.xz forgejo-e68b9d00a6e05b3a941f63ffb696f91e554ac5ec.zip |
Adding upstream version 9.0.3.
Signed-off-by: Daniel Baumann <daniel@debian.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 0000000..de83000 --- /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}} |