|
85 | 85 | </form>
|
86 | 86 | {{end}}
|
87 | 87 | {{if and (not .IsEmpty) ($.Permission.CanRead $.UnitTypeCode)}}
|
88 |
| - <div class="ui labeled button{{if not $.CanSignedUserFork}} tooltip disabled{{end}}"{{if and (not $.CanSignedUserFork) $.IsSigned}} data-content="{{$.i18n.Tr "repo.fork_from_self"}}" {{else if not $.IsSigned}} data-content="{{$.i18n.Tr "repo.fork_guest_user"}}"{{end}} data-position="top center" tabindex="0"> |
89 |
| - <a class="ui compact small basic button"{{if $.CanSignedUserFork}} href="{{AppSubUrl}}/repo/fork/{{.ID}}"{{end}}> |
| 88 | + <div class="ui labeled button |
| 89 | + {{if or (not $.IsSigned) (and (not $.CanSignedUserFork) (eq (len $.UserAndOrgForks) 0))}} |
| 90 | + tooltip disabled |
| 91 | + {{end}}" |
| 92 | + {{if not $.IsSigned}} |
| 93 | + data-content="{{$.i18n.Tr "repo.fork_guest_user"}}" |
| 94 | + {{else if and (not $.CanSignedUserFork) (eq (len $.UserAndOrgForks) 0)}} |
| 95 | + data-content="{{$.i18n.Tr "repo.fork_from_self"}}" |
| 96 | + {{end}} |
| 97 | + data-position="top center" data-variation="tiny" tabindex="0"> |
| 98 | + <a class="ui compact{{if $.ShowForkModal}} show-modal{{end}} small basic button" |
| 99 | + {{if not $.CanSignedUserFork}} |
| 100 | + {{if gt (len $.UserAndOrgForks) 1}} |
| 101 | + data-modal="#fork-repo-modal" |
| 102 | + {{else if eq (len $.UserAndOrgForks) 1}} |
| 103 | + href="{{AppSubUrl}}/{{(index $.UserAndOrgForks 0).FullName}}" |
| 104 | + {{/*else is not required here, because the button shouldn't link to any site if you can't create a fork*/}} |
| 105 | + {{end}} |
| 106 | + {{else if eq (len $.UserAndOrgForks) 0}} |
| 107 | + href="{{AppSubUrl}}/repo/fork/{{.ID}}" |
| 108 | + {{else}} |
| 109 | + data-modal="#fork-repo-modal" |
| 110 | + {{end}} |
| 111 | + > |
90 | 112 | {{svg "octicon-repo-forked"}}{{$.i18n.Tr "repo.fork"}}
|
91 | 113 | </a>
|
| 114 | + <div class="ui small modal" id="fork-repo-modal"> |
| 115 | + {{svg "octicon-x" 16 "close inside"}} |
| 116 | + <div class="header"> |
| 117 | + {{$.i18n.Tr "repo.already_forked" .Name}} |
| 118 | + </div> |
| 119 | + <div class="content tl"> |
| 120 | + <div class="ui list"> |
| 121 | + {{range $.UserAndOrgForks}} |
| 122 | + <div class="ui item py-3"> |
| 123 | + <a href="{{.Link}}"> |
| 124 | + {{svg "octicon-repo-forked" 16 "mr-3"}}{{.FullName}} |
| 125 | + </a> |
| 126 | + </div> |
| 127 | + {{end}} |
| 128 | + </div> |
| 129 | + {{if $.CanSignedUserFork}} |
| 130 | + <div class="ui divider"></div> |
| 131 | + <a href="{{AppSubUrl}}/repo/fork/{{.ID}}"> |
| 132 | + {{$.i18n.Tr "repo.fork_to_different_account"}} |
| 133 | + </a> |
| 134 | + {{end}} |
| 135 | + </div> |
| 136 | + </div> |
92 | 137 | <a class="ui basic label" href="{{.Link}}/forks">
|
93 | 138 | {{CountFmt .NumForks}}
|
94 | 139 | </a>
|
|
0 commit comments