You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

clone_buttons.tmpl 1.8 kB

1234567891011121314151617181920212223242526272829303132333435
  1. {{if not $.DisableHTTP}}
  2. <button class="ui basic clone button no-transition" id="repo-clone-https" data-link="{{.CloneLink.HTTPS}}">
  3. {{if UseHTTPS}}HTTPS{{else}}HTTP{{end}}
  4. </button>
  5. {{end}}
  6. {{if and (not $.DisableSSH) (or $.IsSigned $.ExposeAnonSSH)}}
  7. <button class="ui basic clone button no-transition" id="repo-clone-ssh" data-link="{{.CloneLink.SSH}}">
  8. SSH
  9. </button>
  10. {{end}}
  11. {{if not $.DisableHTTP}}
  12. <input id="repo-clone-url" value="{{$.CloneLink.HTTPS}}" readonly>
  13. {{else if and (not .DisableSSH) (or $.IsSigned $.ExposeAnonSSH)}}
  14. <input id="repo-clone-url" value="{{$.CloneLink.SSH}}" readonly>
  15. {{end}}
  16. {{if or (not $.DisableHTTP) (and (not $.DisableSSH) (or $.IsSigned $.ExposeAnonSSH))}}
  17. <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">
  18. {{svg "octicon-clippy"}}
  19. </button>
  20. {{end}}
  21. {{if not (and $.DisableHTTP $.DisableSSH)}}
  22. <script defer>
  23. const isSSH = localStorage.getItem('repo-clone-protocol') === 'ssh';
  24. const sshButton = document.getElementById('repo-clone-ssh');
  25. const httpsButton = document.getElementById('repo-clone-https');
  26. const input = document.getElementById('repo-clone-url');
  27. if (input) input.value = (isSSH ? sshButton : httpsButton).dataset.link;
  28. if (sshButton) sshButton.classList[isSSH ? 'add' : 'remove']('primary');
  29. if (httpsButton) httpsButton.classList[isSSH ? 'remove' : 'add']('primary');
  30. setTimeout(() => {
  31. if (sshButton) sshButton.classList.remove('no-transition');
  32. if (httpsButton) httpsButton.classList.remove('no-transition');
  33. }, 100);
  34. </script>
  35. {{end}}