Skip to content

Commit 449b39e

Browse files
authored
Fix sub folder in repository missing add file dropdown (#21069) (#21083)
Backport #21069 In repository sub folder missing add file dropdown menu, Probably broken since #20602
1 parent 06f968d commit 449b39e

File tree

1 file changed

+27
-26
lines changed

1 file changed

+27
-26
lines changed

templates/repo/home.tmpl

+27-26
Original file line numberDiff line numberDiff line change
@@ -73,33 +73,34 @@
7373
</a>
7474
{{end}}
7575
<a href="{{.Repository.Link}}/find/{{.BranchNameSubURL}}" class="ui compact basic button tooltip" data-content="{{.i18n.Tr "repo.find_file.go_to_file"}}">{{svg "octicon-file-moved" 15}}</a>
76-
{{if or .CanAddFile .CanUploadFile}}
77-
<button class="ui basic small compact dropdown jump icon button mr-2">
78-
<span class="text">{{.i18n.Tr "repo.editor.add_file"}}</span>
79-
<div class="menu">
80-
{{if .Repository.CanEnableEditor}}
81-
{{if .CanAddFile}}
82-
<a class="item" href="{{.RepoLink}}/_new/{{.BranchName | PathEscapeSegments}}/{{.TreePath | PathEscapeSegments}}">
83-
{{.i18n.Tr "repo.editor.new_file"}}
84-
</a>
85-
{{end}}
86-
{{if .CanUploadFile}}
87-
<a class="item" href="{{.RepoLink}}/_upload/{{.BranchName | PathEscapeSegments}}/{{.TreePath | PathEscapeSegments}}">
88-
{{.i18n.Tr "repo.editor.upload_file"}}
89-
</a>
90-
{{end}}
91-
{{if .CanAddFile}}
92-
<a class="item" href="{{.RepoLink}}/_diffpatch/{{.BranchName | PathEscapeSegments}}/{{.TreePath | PathEscapeSegments}}">
93-
{{.i18n.Tr "repo.editor.patch"}}
94-
</a>
95-
{{end}}
76+
{{end}}
77+
{{if or .CanAddFile .CanUploadFile}}
78+
<button class="ui basic small compact dropdown jump icon button mr-2">
79+
<span class="text">{{.i18n.Tr "repo.editor.add_file"}}</span>
80+
<div class="menu">
81+
{{if .Repository.CanEnableEditor}}
82+
{{if .CanAddFile}}
83+
<a class="item" href="{{.RepoLink}}/_new/{{.BranchName | PathEscapeSegments}}/{{.TreePath | PathEscapeSegments}}">
84+
{{.i18n.Tr "repo.editor.new_file"}}
85+
</a>
9686
{{end}}
97-
</div>
98-
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
99-
</button>
100-
{{end}}
101-
{{else}}
102-
<span class="ui breadcrumb repo-path"><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>
87+
{{if .CanUploadFile}}
88+
<a class="item" href="{{.RepoLink}}/_upload/{{.BranchName | PathEscapeSegments}}/{{.TreePath | PathEscapeSegments}}">
89+
{{.i18n.Tr "repo.editor.upload_file"}}
90+
</a>
91+
{{end}}
92+
{{if .CanAddFile}}
93+
<a class="item" href="{{.RepoLink}}/_diffpatch/{{.BranchName | PathEscapeSegments}}/{{.TreePath | PathEscapeSegments}}">
94+
{{.i18n.Tr "repo.editor.patch"}}
95+
</a>
96+
{{end}}
97+
{{end}}
98+
</div>
99+
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
100+
</button>
101+
{{end}}
102+
{{if ne $n 0}}
103+
<span class="ui breadcrumb repo-path"><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>
103104
{{end}}
104105
</div>
105106
<div class="df ac">

0 commit comments

Comments
 (0)