summaryrefslogtreecommitdiffstats
path: root/templates/repo/header_fork.tmpl
diff options
context:
space:
mode:
authorDaniel Baumann <daniel@debian.org>2024-10-18 20:33:49 +0200
committerDaniel Baumann <daniel@debian.org>2024-10-18 20:33:49 +0200
commitdd136858f1ea40ad3c94191d647487fa4f31926c (patch)
tree58fec94a7b2a12510c9664b21793f1ed560c6518 /templates/repo/header_fork.tmpl
parentInitial commit. (diff)
downloadforgejo-dd136858f1ea40ad3c94191d647487fa4f31926c.tar.xz
forgejo-dd136858f1ea40ad3c94191d647487fa4f31926c.zip
Adding upstream version 9.0.0.HEADupstream/9.0.0upstreamdebian
Signed-off-by: Daniel Baumann <daniel@debian.org>
Diffstat (limited to 'templates/repo/header_fork.tmpl')
-rw-r--r--templates/repo/header_fork.tmpl52
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}}