fix code search template
This commit is contained in:
parent
f89f7ced5f
commit
aec787b927
4 changed files with 6 additions and 10 deletions
|
@ -86,7 +86,7 @@ func Search(ctx *context.Context) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.Data["CodeIndexerEnabled"] = setting.Indexer.RepoIndexerEnabled
|
ctx.Data["CodeIndexerDisabled"] = !setting.Indexer.RepoIndexerEnabled
|
||||||
ctx.Data["Repo"] = ctx.Repo.Repository
|
ctx.Data["Repo"] = ctx.Repo.Repository
|
||||||
ctx.Data["SourcePath"] = ctx.Repo.Repository.Link()
|
ctx.Data["SourcePath"] = ctx.Repo.Repository.Link()
|
||||||
ctx.Data["SearchResults"] = searchResults
|
ctx.Data["SearchResults"] = searchResults
|
||||||
|
|
|
@ -24,10 +24,10 @@
|
||||||
{{else}}
|
{{else}}
|
||||||
<span class="file tw-flex-1">{{.Filename}}</span>
|
<span class="file tw-flex-1">{{.Filename}}</span>
|
||||||
{{end}}
|
{{end}}
|
||||||
<a role="button" class="ui basic tiny button" rel="nofollow" href="{{$repo.Link}}/src/{{if $.CodeIndexerDisabled}}branch{{else}}commit{{end}}/{{$result.CommitID | PathEscape}}/{{.Filename | PathEscapeSegments}}">{{ctx.Locale.Tr "repo.diff.view_file"}}</a>
|
<a role="button" class="ui basic tiny button" rel="nofollow" href="{{$repo.Link}}/src/commit/{{$result.CommitID | PathEscape}}/{{.Filename | PathEscapeSegments}}">{{ctx.Locale.Tr "repo.diff.view_file"}}</a>
|
||||||
</h4>
|
</h4>
|
||||||
<div class="ui attached table segment">
|
<div class="ui attached table segment">
|
||||||
{{template "shared/searchfile" dict "RepoLink" $repo.Link "CodeIndexerDisabled" $.CodeIndexerDisabled "SearchResult" .}}
|
{{template "shared/searchfile" dict "RepoLink" $repo.Link "SearchResult" .}}
|
||||||
</div>
|
</div>
|
||||||
{{template "shared/searchbottom" dict "root" $ "result" .}}
|
{{template "shared/searchbottom" dict "root" $ "result" .}}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,9 +1,5 @@
|
||||||
<form class="ui form ignore-dirty">
|
<form class="ui form ignore-dirty">
|
||||||
{{if not $.CodeIndexerDisabled}}
|
|
||||||
{{template "shared/search/combo_fuzzy" dict "Value" .Keyword "Disabled" .CodeIndexerUnavailable "IsFuzzy" .IsFuzzy "Placeholder" (ctx.Locale.Tr "search.code_kind")}}
|
{{template "shared/search/combo_fuzzy" dict "Value" .Keyword "Disabled" .CodeIndexerUnavailable "IsFuzzy" .IsFuzzy "Placeholder" (ctx.Locale.Tr "search.code_kind")}}
|
||||||
{{else}}
|
|
||||||
{{template "shared/search/combo" dict "Value" .Keyword "Placeholder" (ctx.Locale.Tr "search.code_kind")}}
|
|
||||||
{{end}}
|
|
||||||
</form>
|
</form>
|
||||||
<div class="divider"></div>
|
<div class="divider"></div>
|
||||||
<div class="ui user list">
|
<div class="ui user list">
|
||||||
|
@ -12,7 +8,7 @@
|
||||||
<p>{{ctx.Locale.Tr "search.code_search_unavailable"}}</p>
|
<p>{{ctx.Locale.Tr "search.code_search_unavailable"}}</p>
|
||||||
</div>
|
</div>
|
||||||
{{else}}
|
{{else}}
|
||||||
{{if not .CodeIndexerEnabled}}
|
{{if .CodeIndexerDisabled}}
|
||||||
<div class="ui message">
|
<div class="ui message">
|
||||||
<p>{{ctx.Locale.Tr "search.code_search_by_git_grep"}}</p>
|
<p>{{ctx.Locale.Tr "search.code_search_by_git_grep"}}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
{{range .SearchResult.Lines}}
|
{{range .SearchResult.Lines}}
|
||||||
<tr>
|
<tr>
|
||||||
<td class="lines-num">
|
<td class="lines-num">
|
||||||
<a href="{{$.RepoLink}}/src/{{if $.CodeIndexerDisabled}}branch{{else}}commit{{end}}/{{PathEscape $.SearchResult.CommitID}}/{{PathEscapeSegments $.SearchResult.Filename}}#L{{.Num}}"><span>{{.Num}}</span></a>
|
<a href="{{$.RepoLink}}/src/commit/{{PathEscape $.SearchResult.CommitID}}/{{PathEscapeSegments $.SearchResult.Filename}}#L{{.Num}}"><span>{{.Num}}</span></a>
|
||||||
</td>
|
</td>
|
||||||
<td class="lines-code chroma"><code class="code-inner">{{.FormattedContent}}</code></td>
|
<td class="lines-code chroma"><code class="code-inner">{{.FormattedContent}}</code></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
Loading…
Reference in a new issue