Skip to content

Commit ceede0f

Browse files
committed
fix
1 parent 2ad9ef4 commit ceede0f

File tree

4 files changed

+12
-14
lines changed

4 files changed

+12
-14
lines changed

routers/web/repo/commit.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,6 @@ func SearchCommits(ctx *context.Context) {
212212

213213
// FileHistory show a file's reversions
214214
func FileHistory(ctx *context.Context) {
215-
ctx.Data["IsRepoToolbarCommits"] = true
216-
217215
fileName := ctx.Repo.TreePath
218216
if len(fileName) == 0 {
219217
Commits(ctx)

routers/web/repo/compare.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -800,7 +800,6 @@ func CompareDiff(ctx *context.Context) {
800800
}
801801
ctx.Data["Title"] = "Comparing " + base.ShortSha(beforeCommitID) + separator + base.ShortSha(afterCommitID)
802802

803-
ctx.Data["IsRepoToolbarCommits"] = true
804803
ctx.Data["IsDiffCompare"] = true
805804
_, templateErrs := setTemplateIfExists(ctx, pullRequestTemplateKey, pullRequestTemplateCandidates)
806805

routers/web/repo/pull.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1225,7 +1225,6 @@ func CompareAndPullRequestPost(ctx *context.Context) {
12251225
ctx.Data["Title"] = ctx.Tr("repo.pulls.compare_changes")
12261226
ctx.Data["PageIsComparePull"] = true
12271227
ctx.Data["IsDiffCompare"] = true
1228-
ctx.Data["IsRepoToolbarCommits"] = true
12291228
ctx.Data["PullRequestWorkInProgressPrefixes"] = setting.Repository.PullRequest.WorkInProgressPrefixes
12301229
ctx.Data["IsAttachmentEnabled"] = setting.Attachment.Enabled
12311230
upload.AddUploadContext(ctx, "comment")

templates/repo/home.tmpl

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,16 @@
9090
{{ctx.Locale.Tr "repo.use_template"}}
9191
</a>
9292
{{end}}
93-
{{if (not $isHomepage)}}
93+
{{if $isHomepage}}
94+
{{/* only show the "code search" on the repo home page, it only does global search,
95+
so do not show it when viewing file or directory to avoid misleading users (it doesn't search in a directory) */}}
96+
<form class="ignore-dirty" action="{{.RepoLink}}/search" method="get">
97+
<div class="ui small action input">
98+
<input name="q" value="{{.Keyword}}" placeholder="{{ctx.Locale.Tr "search.code_kind"}}">
99+
{{template "shared/search/button"}}
100+
</div>
101+
</form>
102+
{{else}}
94103
<span class="breadcrumb repo-path tw-ml-1">
95104
<a class="section" href="{{.RepoLink}}/src/{{.BranchNameSubURL}}" title="{{.Repository.Name}}">{{StringUtils.EllipsisString .Repository.Name 30}}</a>
96105
{{- range $i, $v := .TreeNames -}}
@@ -103,13 +112,6 @@
103112
{{- end -}}
104113
</span>
105114
{{end}}
106-
107-
<form class="ignore-dirty" action="{{.RepoLink}}/search" method="get">
108-
<div class="ui small action input">
109-
<input name="q" value="{{.Keyword}}" placeholder="{{ctx.Locale.Tr "search.code_kind"}}">
110-
{{template "shared/search/button"}}
111-
</div>
112-
</form>
113115
</div>
114116
<div class="tw-flex tw-items-center">
115117
<!-- Only show clone panel in repository home page -->
@@ -136,7 +138,7 @@
136138
</div>
137139
{{template "repo/cite/cite_modal" .}}
138140
{{end}}
139-
{{if and (not $isHomepage) (not .IsViewFile) (not .IsBlame)}}
141+
{{if and (not $isHomepage) (not .IsViewFile) (not .IsBlame)}}{{/* IsViewDirectory (not home) */}}
140142
<a class="ui button" href="{{.RepoLink}}/commits/{{.BranchNameSubURL}}/{{.TreePath | PathEscapeSegments}}">
141143
{{svg "octicon-history" 16 "tw-mr-2"}}{{ctx.Locale.Tr "repo.file_history"}}
142144
</a>
@@ -147,7 +149,7 @@
147149
{{template "repo/view_file" .}}
148150
{{else if .IsBlame}}
149151
{{template "repo/blame" .}}
150-
{{else}}
152+
{{else}}{{/* IsViewDirectory */}}
151153
{{template "repo/view_list" .}}
152154
{{end}}
153155
</div>

0 commit comments

Comments
 (0)