Skip to content

Commit 14b106a

Browse files
committed
fix
1 parent dd8c361 commit 14b106a

20 files changed

+184
-310
lines changed

options/locale/locale_en-US.ini

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1038,8 +1038,6 @@ view_all_tags = View all tags
10381038
fork_no_valid_owners = This repository can not be forked because there are no valid owners.
10391039
fork.blocked_user = Cannot fork the repository because you are blocked by the repository owner.
10401040
use_template = Use this template
1041-
clone_https_description = Use Git via the web URL.
1042-
clone_ssh_description = Use a password protected SSH key.
10431041
open_with_editor = Open with %s
10441042
download_zip = Download ZIP
10451043
download_tar = Download TAR.GZ

routers/web/repo/view_home.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ func prepareOpenWithEditorApps(ctx *context.Context) {
7474
schema, _, _ := strings.Cut(app.OpenURL, ":")
7575
var iconHTML template.HTML
7676
if schema == "vscode" || schema == "vscodium" || schema == "jetbrains" {
77-
iconHTML = svg.RenderHTML(fmt.Sprintf("gitea-%s", schema), 16, "tw-mr-2")
77+
iconHTML = svg.RenderHTML(fmt.Sprintf("gitea-%s", schema), 16)
7878
} else {
79-
iconHTML = svg.RenderHTML("gitea-git", 16, "tw-mr-2") // TODO: it could support user's customized icon in the future
79+
iconHTML = svg.RenderHTML("gitea-git", 16) // TODO: it could support user's customized icon in the future
8080
}
8181
tmplApps = append(tmplApps, map[string]any{
8282
"DisplayName": app.DisplayName,

templates/repo/clone_buttons.tmpl

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
<!-- there is always at least one button (by context/repo.go) -->
2-
{{if $.CloneButtonShowHTTPS}}
3-
<button class="ui small button" id="repo-clone-https" data-link="{{$.CloneButtonOriginLink.HTTPS}}">
4-
HTTPS
2+
<div class="ui action small input clone-buttons-combo">
3+
{{if $.CloneButtonShowHTTPS}}
4+
<button class="ui small button repo-clone-https" data-link="{{$.CloneButtonOriginLink.HTTPS}}">
5+
HTTPS
6+
</button>
7+
{{end}}
8+
{{if $.CloneButtonShowSSH}}
9+
<button class="ui small button repo-clone-ssh" data-link="{{$.CloneButtonOriginLink.SSH}}">
10+
SSH
11+
</button>
12+
{{end}}
13+
<input size="10" class="repo-clone-url js-clone-url" value="{{$.CloneButtonOriginLink.HTTPS}}" readonly>
14+
<button class="ui small icon button" data-clipboard-target=".repo-clone-url" data-tooltip-content="{{ctx.Locale.Tr "copy_url"}}" aria-label="{{ctx.Locale.Tr "copy_url"}}">
15+
{{svg "octicon-copy" 14}}
516
</button>
6-
{{end}}
7-
{{if $.CloneButtonShowSSH}}
8-
<button class="ui small button" id="repo-clone-ssh" data-link="{{$.CloneButtonOriginLink.SSH}}">
9-
SSH
10-
</button>
11-
{{end}}
12-
<input id="repo-clone-url" size="10" class="js-clone-url" value="{{$.CloneButtonOriginLink.HTTPS}}" readonly>
13-
<button class="ui small icon button" id="clipboard-btn" data-tooltip-content="{{ctx.Locale.Tr "copy_url"}}" data-clipboard-target="#repo-clone-url" aria-label="{{ctx.Locale.Tr "copy_url"}}">
14-
{{svg "octicon-copy" 14}}
15-
</button>
17+
</div>

templates/repo/clone_panel.tmpl

Lines changed: 38 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,44 @@
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}}
6424
</div>
6525
</div>
66-
{{template "repo/clone_script" .}}{{/* the script will update `.js-clone-url` and related elements */}}
67-
{{template "repo/cite/cite_modal" .}}
6826
</div>
69-
{{end}}
7027

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}}
7543
{{end}}
7644
</div>

templates/repo/clone_script.tmpl

Lines changed: 0 additions & 55 deletions
This file was deleted.

templates/repo/empty.tmpl

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,7 @@
3737
</a>
3838
{{end}}
3939
{{end}}
40-
<div class="clone-panel ui action small input tw-flex-1">
41-
{{template "repo/clone_buttons" .}}
42-
</div>
40+
{{template "repo/clone_buttons" .}}
4341
</div>
4442
</div>
4543

@@ -73,7 +71,6 @@ git push -u origin {{.Repository.DefaultBranch}}</code></pre>
7371
{{ctx.Locale.Tr "repo.empty_message"}}
7472
</div>
7573
{{end}}
76-
{{template "repo/clone_script" .}}
7774
</div>
7875
</div>
7976
</div>

templates/repo/home.tmpl

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -106,23 +106,7 @@
106106
<div class="repo-button-row-right {{if not $isTreePathRoot}}tw-flex-grow-0{{end}}">
107107
<!-- Only show clone panel in repository home page -->
108108
{{if $isTreePathRoot}}
109-
<div class="clone-panel ui action tiny input">
110-
{{template "repo/clone_buttons" .}}
111-
<button class="ui small jump dropdown icon button" data-tooltip-content="{{ctx.Locale.Tr "repo.more_operations"}}">
112-
{{svg "octicon-kebab-horizontal"}}
113-
<div class="menu">
114-
{{if not $.DisableDownloadSourceArchives}}
115-
<a class="item archive-link" href="{{$.RepoLink}}/archive/{{PathEscapeSegments $.RefName}}.zip" rel="nofollow">{{svg "octicon-file-zip" 16 "tw-mr-2"}}{{ctx.Locale.Tr "repo.download_zip"}}</a>
116-
<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>
117-
<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>
118-
{{end}}
119-
{{range .OpenWithEditorApps}}
120-
<a class="item js-clone-url-editor" data-href-template="{{.OpenURL}}">{{.IconHTML}}{{ctx.Locale.Tr "repo.open_with_editor" .DisplayName}}</a>
121-
{{end}}
122-
</div>
123-
</button>
124-
{{template "repo/clone_script" .}}{{/* the script will update `.js-clone-url` and related elements */}}
125-
</div>
109+
{{template "repo/clone_panel" .}}
126110
{{end}}
127111
{{if and (not $isTreePathRoot) (not .IsViewFile) (not .IsBlame)}}{{/* IsViewDirectory (not home), TODO: split the templates, avoid using "if" tricks */}}
128112
<a class="ui button" href="{{.RepoLink}}/commits/{{.BranchNameSubURL}}/{{.TreePath | PathEscapeSegments}}">

templates/repo/wiki/revision.tmpl

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,7 @@
1515
</div>
1616
</div>
1717
<div class="ui eight wide column text right">
18-
<div class="clone-panel ui action small input">
19-
{{template "repo/clone_buttons" .}}
20-
{{template "repo/clone_script" .}}
21-
</div>
18+
{{template "repo/clone_panel" .}}
2219
</div>
2320
</div>
2421
<h2 class="ui top header">{{ctx.Locale.Tr "repo.wiki.wiki_page_revisions"}}</h2>

templates/repo/wiki/view.tmpl

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,7 @@
2828
</div>
2929
</div>
3030
</div>
31-
<div class="clone-panel ui action small input">
32-
{{template "repo/clone_buttons" .}}
33-
{{template "repo/clone_script" .}}
34-
</div>
31+
{{template "repo/clone_panel" .}}
3532
</div>
3633
<div class="ui dividing header">
3734
<div class="flex-text-block tw-flex-wrap tw-justify-end">

web_src/css/index.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
@import "./repo/header.css";
6868
@import "./repo/home.css";
6969
@import "./repo/reactions.css";
70+
@import "./repo/clone.css";
7071

7172
@import "./editor/fileeditor.css";
7273
@import "./editor/combomarkdowneditor.css";

web_src/css/repo.css

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -101,58 +101,6 @@
101101
margin-bottom: 12px;
102102
}
103103

104-
.repository .clone-panel {
105-
display: flex;
106-
flex: 1;
107-
min-width: 200px;
108-
}
109-
110-
.repository.wiki .clone-panel {
111-
flex: 0;
112-
}
113-
114-
.repository.wiki .clone-panel input {
115-
width: 20ch;
116-
}
117-
118-
.repository .clone-panel #repo-clone-url {
119-
border-radius: 0;
120-
flex: 1;
121-
}
122-
123-
.repository .ui.action.input.clone-panel > button + button,
124-
.repository .ui.action.input.clone-panel > button + input {
125-
margin-left: -1px; /* make the borders overlap to avoid double borders */
126-
}
127-
128-
.repository #clone-panel {
129-
position: relative;
130-
}
131-
132-
.clone-panel .ui.segment {
133-
border: none;
134-
}
135-
136-
.repository .clone-panel > button {
137-
border-radius: var(--border-radius) !important;
138-
}
139-
140-
.clone.tabs {
141-
cursor: pointer;
142-
143-
border-bottom: 3px solid;
144-
border-color: transparent;
145-
146-
font-weight: var(--font-weight-semibold);
147-
font-size: 1rem;
148-
149-
padding: 0.5rem;
150-
}
151-
152-
.clone.tabs.primary {
153-
border-color: var(--color-primary);
154-
}
155-
156104
.repository .repo-description {
157105
font-size: 16px;
158106
margin-bottom: 5px;
@@ -1631,14 +1579,6 @@ td .commit-summary {
16311579
font-weight: var(--font-weight-normal);
16321580
}
16331581

1634-
.repository.quickstart .guide #repo-clone-url {
1635-
border-radius: 0;
1636-
padding: 5px 10px;
1637-
font-size: 1.2em;
1638-
line-height: 1.4;
1639-
flex: 1
1640-
}
1641-
16421582
.empty-placeholder {
16431583
display: flex;
16441584
flex-direction: column;

0 commit comments

Comments
 (0)