Skip to content

Commit 3d8e5ca

Browse files
silverwindtechknowlogick
authored andcommitted
Fix and move "Use this template" button (go-gitea#23398)
Before: <img width="1157" alt="Screenshot 2023-03-09 at 23 21 25" src="https://user-images.githubusercontent.com/115237/224174168-869966cc-fa59-4231-b449-23bd9db12862.png"> After: <img width="1145" alt="Screenshot 2023-03-09 at 23 24 34" src="https://user-images.githubusercontent.com/115237/224174173-7f5b9c22-44c4-4eed-990c-da49d749eb0e.png"> --------- Co-authored-by: techknowlogick <[email protected]>
1 parent 43cf04c commit 3d8e5ca

File tree

3 files changed

+28
-11
lines changed

3 files changed

+28
-11
lines changed

templates/repo/home.tmpl

+6-10
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
{{end}}
6464
{{template "repo/sub_menu" .}}
6565
<div class="repo-button-row gt-df gt-ac gt-sb gt-fw">
66-
<div class="gt-df gt-ac">
66+
<div class="gt-df gt-ac gt-fw gt-gap-y-3">
6767
{{template "repo/branch_dropdown" dict "root" .}}
6868
{{$n := len .TreeNames}}
6969
{{$l := Subtract $n 1}}
@@ -99,20 +99,16 @@
9999
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
100100
</button>
101101
{{end}}
102+
{{if and (eq $n 0) (.Repository.IsTemplate)}}
103+
<a role="button" class="ui primary compact button" href="{{AppSubUrl}}/repo/create?template_id={{.Repository.ID}}">
104+
{{.locale.Tr "repo.use_template"}}
105+
</a>
106+
{{end}}
102107
{{if ne $n 0}}
103108
<span class="ui breadcrumb repo-path gt-ml-2"><a class="section" href="{{.RepoLink}}/src/{{.BranchNameSubURL}}" title="{{.Repository.Name}}">{{EllipsisString .Repository.Name 30}}</a>{{range $i, $v := .TreeNames}}<span class="divider">/</span>{{if eq $i $l}}<span class="active section" title="{{$v}}">{{EllipsisString $v 30}}</span>{{else}}{{$p := index $.Paths $i}}<span class="section"><a href="{{$.BranchLink}}/{{PathEscapeSegments $p}}" title="{{$v}}">{{EllipsisString $v 30}}</a></span>{{end}}{{end}}</span>
104109
{{end}}
105110
</div>
106111
<div class="gt-df gt-ac">
107-
{{if eq $n 0}}
108-
{{if .Repository.IsTemplate}}
109-
<div class="ui tiny primary buttons">
110-
<a href="{{AppSubUrl}}/repo/create?template_id={{.Repository.ID}}" class="ui button">
111-
{{.locale.Tr "repo.use_template"}}
112-
</a>
113-
</div>
114-
{{end}}
115-
{{end}}
116112
<!-- Only show clone panel in repository home page -->
117113
{{if eq $n 0}}
118114
<div class="ui action tiny input" id="clone-panel">

web_src/less/_repository.less

+1-1
Original file line numberDiff line numberDiff line change
@@ -2869,7 +2869,7 @@
28692869
}
28702870

28712871
.repo-button-row > * {
2872-
margin-top: 10px;
2872+
margin-top: 8px;
28732873
}
28742874

28752875
.wiki .repo-button-row {

web_src/less/helpers.less

+21
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,27 @@
172172
.gt-py-4 { padding-top: 1rem !important; padding-bottom: 1rem !important; }
173173
.gt-py-5 { padding-top: 2rem !important; padding-bottom: 2rem !important; }
174174

175+
.gt-gap-0 { gap: 0 !important; }
176+
.gt-gap-1 { gap: .125rem !important; }
177+
.gt-gap-2 { gap: .25rem !important; }
178+
.gt-gap-3 { gap: .5rem !important; }
179+
.gt-gap-4 { gap: 1rem !important; }
180+
.gt-gap-5 { gap: 2rem !important; }
181+
182+
.gt-gap-x-0 { column-gap: 0 !important; }
183+
.gt-gap-x-1 { column-gap: .125rem !important; }
184+
.gt-gap-x-2 { column-gap: .25rem !important; }
185+
.gt-gap-x-3 { column-gap: .5rem !important; }
186+
.gt-gap-x-4 { column-gap: 1rem !important; }
187+
.gt-gap-x-5 { column-gap: 2rem !important; }
188+
189+
.gt-gap-y-0 { row-gap: 0 !important; }
190+
.gt-gap-y-1 { row-gap: .125rem !important; }
191+
.gt-gap-y-2 { row-gap: .25rem !important; }
192+
.gt-gap-y-3 { row-gap: .5rem !important; }
193+
.gt-gap-y-4 { row-gap: 1rem !important; }
194+
.gt-gap-y-5 { row-gap: 2rem !important; }
195+
175196
.gt-content-center { align-content: center !important; }
176197

177198
@media @mediaSm {

0 commit comments

Comments
 (0)