|
106 | 106 | {{end}} |
107 | 107 | </div> |
108 | 108 | <div class="fitted item"> |
109 | | - |
110 | 109 | <!-- Only show clone panel in repository home page --> |
111 | 110 | {{if eq $n 0}} |
112 | 111 | <div class="ui action tiny input" id="clone-panel"> |
113 | | - {{if not $.DisableHTTP}} |
114 | | - <button class="ui basic clone button no-transition" id="repo-clone-https" data-link="{{.CloneLink.HTTPS}}"> |
115 | | - {{if UseHTTPS}}HTTPS{{else}}HTTP{{end}} |
116 | | - </button> |
117 | | - {{end}} |
118 | | - {{if and (not $.DisableSSH) (or $.IsSigned $.ExposeAnonSSH)}} |
119 | | - <button class="ui basic clone button no-transition" id="repo-clone-ssh" data-link="{{.CloneLink.SSH}}"> |
120 | | - SSH |
121 | | - </button> |
122 | | - {{end}} |
123 | | - {{if not $.DisableHTTP}} |
124 | | - <input id="repo-clone-url" value="{{$.CloneLink.HTTPS}}" readonly> |
125 | | - {{else if and (not $.DisableSSH) (or $.IsSigned $.ExposeAnonSSH)}} |
126 | | - <input id="repo-clone-url" value="{{$.CloneLink.SSH}}" readonly> |
127 | | - {{end}} |
128 | | - <script defer> |
129 | | - const isSSH = localStorage.getItem('repo-clone-protocol') === 'ssh'; |
130 | | - const sshButton = document.getElementById('repo-clone-ssh'); |
131 | | - const httpsButton = document.getElementById('repo-clone-https'); |
132 | | - const input = document.getElementById('repo-clone-url'); |
133 | | - if (input) input.value = (isSSH ? sshButton : httpsButton).dataset.link; |
134 | | - if (sshButton) sshButton.classList[isSSH ? 'add' : 'remove']('primary'); |
135 | | - if (httpsButton) httpsButton.classList[isSSH ? 'remove' : 'add']('primary'); |
136 | | - setTimeout(() => { |
137 | | - if (sshButton) sshButton.classList.remove('no-transition'); |
138 | | - if (httpsButton) httpsButton.classList.remove('no-transition'); |
139 | | - }, 100); |
140 | | - </script> |
141 | | - {{if or (not $.DisableHTTP) (and (not $.DisableSSH) (or $.IsSigned $.ExposeAnonSSH))}} |
142 | | - <button class="ui basic icon button poping up clipboard" id="clipboard-btn" data-original="{{.i18n.Tr "repo.copy_link"}}" data-success="{{.i18n.Tr "repo.copy_link_success"}}" data-error="{{.i18n.Tr "repo.copy_link_error"}}" data-content="{{.i18n.Tr "repo.copy_link"}}" data-variation="inverted tiny" data-clipboard-target="#repo-clone-url"> |
143 | | - {{svg "octicon-clippy"}} |
144 | | - </button> |
145 | | - {{end}} |
| 112 | + {{template "repo/clone_buttons" .}} |
146 | 113 | <div class="ui basic jump dropdown icon button poping up" data-content="{{.i18n.Tr "repo.download_archive"}}" data-variation="tiny inverted" data-position="top right"> |
147 | 114 | {{svg "octicon-download"}} |
148 | 115 | <div class="menu"> |
|
0 commit comments