Skip to content

Commit 64d0b72

Browse files
committed
WIP
1 parent 68737d1 commit 64d0b72

File tree

7 files changed

+318
-311
lines changed

7 files changed

+318
-311
lines changed

options/locale/locale_en-US.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1325,6 +1325,7 @@ commits.commits = Commits
13251325
commits.no_commits = No commits in common. "%s" and "%s" have entirely different histories.
13261326
commits.nothing_to_compare = These branches are equal.
13271327
commits.search.tooltip = You can prefix keywords with "author:", "committer:", "after:", or "before:", e.g. "revert author:Alice before:2019-01-13".
1328+
commits.search_branch = This Branch
13281329
commits.search_all = All Branches
13291330
commits.author = Author
13301331
commits.message = Message

package-lock.json

Lines changed: 169 additions & 154 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

routers/web/repo/commit.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ func SearchCommits(ctx *context.Context) {
203203

204204
ctx.Data["Keyword"] = query
205205
if all {
206-
ctx.Data["All"] = "checked"
206+
ctx.Data["All"] = true
207207
}
208208
ctx.Data["Username"] = ctx.Repo.Owner.Name
209209
ctx.Data["Reponame"] = ctx.Repo.Repository.Name

templates/repo/branch/list.tmpl

Lines changed: 122 additions & 123 deletions
Large diffs are not rendered by default.

templates/repo/commits_table.tmpl

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,34 @@
88
{{ctx.Locale.Tr "repo.commits.no_commits" $.BaseBranch $.HeadBranch}}
99
{{end}}
1010
</div>
11-
<div class="commits-table-right tw-whitespace-nowrap">
12-
{{if .PageIsCommits}}
13-
<form class="ignore-dirty" action="{{.RepoLink}}/commits/{{.BranchNameSubURL}}/search">
14-
<div class="ui tiny search input">
15-
<input name="q" placeholder="{{ctx.Locale.Tr "search.search_kind" (ctx.Locale.Tr "repo.commits.commits")}}" value="{{.Keyword}}" autofocus>
16-
</div>
17-
18-
<div class="ui tiny checkbox">
19-
<input type="checkbox" name="all" value="true" {{.All}}>
20-
<label>{{ctx.Locale.Tr "repo.commits.search_all"}}</label>
21-
</div>
22-
<button class="ui primary tiny button gt-mr-0" data-panel="#add-deploy-key-panel" data-tooltip-content={{ctx.Locale.Tr "repo.commits.search.tooltip"}}>{{ctx.Locale.Tr "search.search"}}</button>
23-
</form>
24-
{{else if .IsDiffCompare}}
11+
{{if .IsDiffCompare}}
12+
<div class="commits-table-right tw-whitespace-nowrap">
2513
<a href="{{$.CommitRepoLink}}/commit/{{.BeforeCommitID | PathEscape}}" class="ui green sha label gt-mx-0">{{if not .BaseIsCommit}}{{if .BaseIsBranch}}{{svg "octicon-git-branch"}}{{else if .BaseIsTag}}{{svg "octicon-tag"}}{{end}}{{.BaseBranch}}{{else}}{{ShortSha .BaseBranch}}{{end}}</a>
2614
...
2715
<a href="{{$.CommitRepoLink}}/commit/{{.AfterCommitID | PathEscape}}" class="ui green sha label gt-mx-0">{{if not .HeadIsCommit}}{{if .HeadIsBranch}}{{svg "octicon-git-branch"}}{{else if .HeadIsTag}}{{svg "octicon-tag"}}{{end}}{{.HeadBranch}}{{else}}{{ShortSha .HeadBranch}}{{end}}</a>
28-
{{end}}
29-
</div>
16+
</div>
17+
{{end}}
3018
</h4>
3119

20+
{{if .PageIsCommits}}
21+
<div class="ui attached segment">
22+
<form class="ignore-dirty" action="{{.RepoLink}}/commits/{{.BranchNameSubURL}}/search">
23+
<div class="ui fluid action input">
24+
{{template "shared/search/input" dict "Value" .Keyword}}
25+
<div class="ui small dropdown selection {{if .CodeIndexerUnavailable}} disabled{{end}}" data-tooltip-content="{{ctx.Locale.Tr "search.type_tooltip"}}">
26+
<input name="all" type="hidden" value="{{.All}}">{{svg "octicon-triangle-down" 14 "dropdown icon"}}
27+
<div class="text">{{if .All}}{{ctx.Locale.Tr "repo.commits.search_all"}}{{else}}{{ctx.Locale.Tr "repo.commits.search_branch"}}{{end}}</div>
28+
<div class="menu">
29+
<div class="item" data-value="">{{ctx.Locale.Tr "repo.commits.search_branch"}}</div>
30+
<div class="item" data-value="true">{{ctx.Locale.Tr "repo.commits.search_all"}}</div>
31+
</div>
32+
</div>
33+
{{template "shared/search/button" (ctx.Locale.Tr "repo.commits.search.tooltip")}}
34+
</div>
35+
</form>
36+
</div>
37+
{{end}}
38+
3239
{{if and .Commits (gt .CommitCount 0)}}
3340
{{template "repo/commits_list" .}}
3441
{{end}}

templates/repo/home.tmpl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@
2020
{{if .CodeIndexerUnavailable}}
2121
<i class="icon">{{svg "octicon-alert"}}</i>
2222
{{end}}
23-
<button class="ui small icon button"{{if .CodeIndexerUnavailable}} disabled{{end}} type="submit">
24-
{{svg "octicon-search"}}
25-
</button>
23+
{{template "shared/search/button"}}
2624
</div>
2725
</div>
2826
</form>

templates/repo/search.tmpl

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,7 @@
33
{{template "repo/header" .}}
44
<div class="ui container">
55
<div class="ui repo-search">
6-
<form class="ui form ignore-dirty" method="get">
7-
<div class="ui fluid action input">
8-
<input name="q" value="{{.Keyword}}"{{if .CodeIndexerUnavailable}} disabled{{end}} placeholder="{{ctx.Locale.Tr "search.search_kind" (ctx.Locale.Tr "repository")}}">
9-
<div class="ui dropdown selection {{if .CodeIndexerUnavailable}} disabled{{end}}" data-tooltip-content="{{ctx.Locale.Tr "search.type_tooltip"}}">
10-
<input name="t" type="hidden"{{if .CodeIndexerUnavailable}} disabled{{end}} value="{{.queryType}}">{{svg "octicon-triangle-down" 14 "dropdown icon"}}
11-
<div class="text">{{ctx.Locale.Tr (printf "search.%s" (or .queryType "fuzzy"))}}</div>
12-
<div class="menu">
13-
<div class="item" data-value="" data-tooltip-content="{{ctx.Locale.Tr "search.fuzzy_tooltip"}}">{{ctx.Locale.Tr "search.fuzzy"}}</div>
14-
<div class="item" data-value="match" data-tooltip-content="{{ctx.Locale.Tr "search.match_tooltip"}}">{{ctx.Locale.Tr "search.match"}}</div>
15-
</div>
16-
</div>
17-
<button class="ui icon button"{{if .CodeIndexerUnavailable}} disabled{{end}} type="submit">{{svg "octicon-search" 16}}</button>
18-
</div>
19-
</form>
6+
{{template "code/searchform" .}}
207
</div>
218
{{if .CodeIndexerUnavailable}}
229
<div class="ui error message">

0 commit comments

Comments
 (0)