|
1 | | -{{$n := len .TreeNames}} |
2 | | -{{$l := Eval $n "-" 1}} |
3 | | -{{$isHomepage := (eq $n 0)}} |
4 | | -<div class="repo-button-row-right"> |
5 | | - <!-- Only show clone panel in repository home page --> |
6 | | - {{if $isHomepage}} |
7 | | - <div id="clone-panel"> |
8 | | - <button class="ui tiny primary button tw-pr-1 tw-flex js-btn-clone-panel"> |
9 | | - <span>{{svg "octicon-code" 16}} Code</span> |
10 | | - {{svg "octicon-triangle-down" 14 "dropdown icon"}} |
11 | | - </button> |
12 | | - <div class="clone-panel tippy-target"> |
13 | | - <div class="ui segment"> |
14 | | - <div class="field tw-flex tw-items-center"> |
15 | | - <div class="tw-flex-1">{{svg "octicon-terminal" 16}} Clone</div> |
16 | | - <a class="muted close">{{svg "octicon-x" 16}}</a> |
17 | | - </div> |
18 | | - <div class="ui input tw-mb-0"> |
19 | | - <!-- there is always at least one button (by context/repo.go) --> |
20 | | - {{if $.CloneButtonShowHTTPS}} |
21 | | - <div class="ui clone tabs" id="repo-clone-https" data-link="{{$.CloneButtonOriginLink.HTTPS}}" data-description="{{ctx.Locale.Tr "repo.clone_https_description"}}"> |
22 | | - HTTPS |
23 | | - </div> |
24 | | - {{end}} |
25 | | - {{if $.CloneButtonShowSSH}} |
26 | | - <div class="ui clone tabs" id="repo-clone-ssh" data-link="{{$.CloneButtonOriginLink.SSH}}" data-description="{{ctx.Locale.Tr "repo.clone_ssh_description"}}"> |
27 | | - SSH |
28 | | - </div> |
29 | | - {{end}} |
30 | | - </div> |
31 | | - <div class="ui input tiny action tw-mt-4 tw-mb-0 field"> |
32 | | - <input id="repo-clone-url" size="30" class="js-clone-url" value="{{$.CloneButtonOriginLink.HTTPS}}" readonly> |
33 | | - <div class="ui basic small compact icon button tooltip" id="clipboard-btn" data-tooltip-content="{{ctx.Locale.Tr "copy_url"}}" data-clipboard-target="#repo-clone-url" aria-label="{{ctx.Locale.Tr "copy_url"}}"> |
34 | | - {{svg "octicon-copy" 14}} |
35 | | - </div> |
36 | | - </div> |
37 | | - <div class="divider"></div> |
38 | | - <div id="repo-clone-method-description" class="ui input text tiny grey tw-mt-3"></div> |
39 | | - <ul class="ui list tw-w-full"> |
40 | | - {{range .OpenWithEditorApps}} |
41 | | - <li> |
42 | | - <a class="item js-clone-url-editor" data-href-template="{{.OpenURL}}">{{.IconHTML}}{{ctx.Locale.Tr "repo.open_with_editor" .DisplayName}}</a> |
43 | | - </li> |
44 | | - {{end}} |
45 | | - </ul> |
46 | | - {{if not $.DisableDownloadSourceArchives}} |
47 | | - <div class="divider"></div> |
48 | | - <ul class="ui list tw-w-full"> |
49 | | - <li> |
50 | | - <a class="item archive-lnk" href="{{$.RepoLink}}/archive/{{PathEscapeSegments $.RefName}}.zip" rel="nofollow">{{svg "octicon-file-zip" 16 "tw-mr-2"}}{{ctx.Locale.Tr "repo.download_zip"}}</a> |
51 | | - </li> |
52 | | - <li> |
53 | | - <a class="item archive-link" href="{{$.RepoLink}}/archive/{{PathEscapeSegments $.RefName}}.tar.gz" rel="nofollow">{{svg "octicon-file-zip" 16 "tw-mr-2"}}{{ctx.Locale.Tr "repo.download_tar"}}</a> |
54 | | - </li> |
55 | | - <li> |
56 | | - <a class="item archive-link" href="{{$.RepoLink}}/archive/{{PathEscapeSegments $.RefName}}.bundle" rel="nofollow">{{svg "octicon-package" 16 "tw-mr-2"}}{{ctx.Locale.Tr "repo.download_bundle"}}</a> |
57 | | - </li> |
58 | | - </ul> |
59 | | - {{end}} |
60 | | - {{if .CitiationExist}} |
61 | | - <div class="divider"></div> |
62 | | - <a class="item" id="cite-repo-button">{{svg "octicon-cross-reference" 16 "tw-mr-2"}}{{ctx.Locale.Tr "repo.cite_this_repo"}}</a> |
63 | | - {{end}} |
| 1 | +<button class="ui green button js-btn-clone-panel"> |
| 2 | + <span>{{svg "octicon-code" 16}} Code</span> |
| 3 | + {{svg "octicon-triangle-down" 14 "dropdown icon"}} |
| 4 | +</button> |
| 5 | +<div class="clone-panel-popup tippy-target"> |
| 6 | + <div class="flex-text-block clone-panel-field">{{svg "octicon-terminal"}} Clone</div> |
| 7 | + |
| 8 | + <div class="clone-panel-tab"> |
| 9 | + <!-- there is always at least one button (guaranteed by context/repo.go) --> |
| 10 | + {{if $.CloneButtonShowHTTPS}} |
| 11 | + <button class="item repo-clone-https" data-link="{{$.CloneButtonOriginLink.HTTPS}}">HTTPS</button> |
| 12 | + {{end}} |
| 13 | + {{if $.CloneButtonShowSSH}} |
| 14 | + <button class="item repo-clone-ssh" data-link="{{$.CloneButtonOriginLink.SSH}}">SSH</button> |
| 15 | + {{end}} |
| 16 | + </div> |
| 17 | + <div class="divider"></div> |
| 18 | + |
| 19 | + <div class="clone-panel-field"> |
| 20 | + <div class="ui input tiny action"> |
| 21 | + <input size="30" class="repo-clone-url js-clone-url" value="{{$.CloneButtonOriginLink.HTTPS}}" readonly> |
| 22 | + <div class="ui small compact icon button" data-clipboard-target=".js-clone-url" data-tooltip-content="{{ctx.Locale.Tr "copy_url"}}" aria-label="{{ctx.Locale.Tr "copy_url"}}"> |
| 23 | + {{svg "octicon-copy" 14}} |
64 | 24 | </div> |
65 | 25 | </div> |
66 | | - {{template "repo/clone_script" .}}{{/* the script will update `.js-clone-url` and related elements */}} |
67 | | - {{template "repo/cite/cite_modal" .}} |
68 | 26 | </div> |
69 | | - {{end}} |
70 | 27 |
|
71 | | - {{if and (not $isHomepage) (not .IsViewFile) (not .IsBlame)}}{{/* IsViewDirectory (not home), TODO: split the templates, avoid using "if" tricks */}} |
72 | | - <a class="ui button" href="{{.RepoLink}}/commits/{{.BranchNameSubURL}}/{{.TreePath | PathEscapeSegments}}"> |
73 | | - {{svg "octicon-history" 16 "tw-mr-2"}}{{ctx.Locale.Tr "repo.file_history"}} |
74 | | - </a> |
| 28 | + {{if not .PageIsWiki}} |
| 29 | + <div class="flex-items-block clone-panel-list"> |
| 30 | + {{range .OpenWithEditorApps}} |
| 31 | + <a class="item muted js-clone-url-editor" data-href-template="{{.OpenURL}}">{{.IconHTML}}{{ctx.Locale.Tr "repo.open_with_editor" .DisplayName}}</a> |
| 32 | + {{end}} |
| 33 | + </div> |
| 34 | + |
| 35 | + {{if and (not $.DisableDownloadSourceArchives) $.RefName}} |
| 36 | + <div class="divider"></div> |
| 37 | + <div class="flex-items-block clone-panel-list"> |
| 38 | + <a class="item muted archive-link" href="{{$.RepoLink}}/archive/{{PathEscapeSegments $.RefName}}.zip" rel="nofollow">{{svg "octicon-file-zip"}} {{ctx.Locale.Tr "repo.download_zip"}}</a> |
| 39 | + <a class="item muted archive-link" href="{{$.RepoLink}}/archive/{{PathEscapeSegments $.RefName}}.tar.gz" rel="nofollow">{{svg "octicon-file-zip"}} {{ctx.Locale.Tr "repo.download_tar"}}</a> |
| 40 | + <a class="item muted archive-link" href="{{$.RepoLink}}/archive/{{PathEscapeSegments $.RefName}}.bundle" rel="nofollow">{{svg "octicon-package"}} {{ctx.Locale.Tr "repo.download_bundle"}}</a> |
| 41 | + </div> |
| 42 | + {{end}} |
75 | 43 | {{end}} |
76 | 44 | </div> |
0 commit comments