diff options
author | Earl Warren <earl-warren@noreply.codeberg.org> | 2024-03-28 09:15:47 +0100 |
---|---|---|
committer | Earl Warren <earl-warren@noreply.codeberg.org> | 2024-03-28 09:15:47 +0100 |
commit | 327deee2d7eb71d025587aa4e44386d44e5f1f34 (patch) | |
tree | 5515b76437bf65c2b73a18c5f5a89b05384934c0 /templates | |
parent | Merge pull request '[REFACTOR] webhook endpoint logic cleanup' (#2847) from o... (diff) | |
parent | Fix git grep search limit, add test (#30071) (diff) | |
download | forgejo-327deee2d7eb71d025587aa4e44386d44e5f1f34.tar.xz forgejo-327deee2d7eb71d025587aa4e44386d44e5f1f34.zip |
Merge pull request '[PORT] Support repo code search without setting up an indexer (gitea#29998)' (#2813) from snematoda/port-git-grep into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2813
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Diffstat (limited to 'templates')
-rw-r--r-- | templates/repo/home.tmpl | 25 | ||||
-rw-r--r-- | templates/shared/search/code/search.tmpl | 15 | ||||
-rw-r--r-- | templates/shared/searchbottom.tmpl | 2 |
3 files changed, 21 insertions, 21 deletions
diff --git a/templates/repo/home.tmpl b/templates/repo/home.tmpl index bfb5ab5232..94cff1d6c5 100644 --- a/templates/repo/home.tmpl +++ b/templates/repo/home.tmpl @@ -5,27 +5,18 @@ {{template "base/alert" .}} {{template "repo/code/recently_pushed_new_branches" .}} {{if and (not .HideRepoInfo) (not .IsBlame)}} - <div class="ui repo-description gt-word-break"> - <div id="repo-desc" class="tw-text-16"> + <div class="repo-description"> + <div id="repo-desc" class="gt-word-break tw-text-16"> {{$description := .Repository.DescriptionHTML $.Context}} {{if $description}}<span class="description">{{$description | RenderCodeBlock}}</span>{{else if .IsRepositoryAdmin}}<span class="no-description text-italic">{{ctx.Locale.Tr "repo.no_desc"}}</span>{{end}} <a class="link" href="{{.Repository.Website}}">{{.Repository.Website}}</a> </div> - <div class="ui repo-search"> - <form class="ui form ignore-dirty" action="{{.RepoLink}}/search" method="get"> - <div class="field"> - <div class="ui small action input{{if .CodeIndexerUnavailable}} disabled left icon{{end}}"{{if .CodeIndexerUnavailable}} data-tooltip-content="{{ctx.Locale.Tr "search.code_search_unavailable"}}"{{end}}> - <input name="q" value="{{.Keyword}}"{{if .CodeIndexerUnavailable}} disabled{{end}} placeholder="{{ctx.Locale.Tr "search.code_kind"}}"> - {{if .CodeIndexerUnavailable}} - <i class="icon">{{svg "octicon-alert"}}</i> - {{end}} - <button class="ui small icon button"{{if .CodeIndexerUnavailable}} disabled{{end}} type="submit"> - {{svg "octicon-search"}} - </button> - </div> - </div> - </form> - </div> + <form class="ignore-dirty" action="{{.RepoLink}}/search" method="get"> + <div class="ui small action input"> + <input name="q" value="{{.Keyword}}" placeholder="{{ctx.Locale.Tr "search.code_kind"}}"> + {{template "shared/search/button"}} + </div> + </form> </div> <div class="tw-flex tw-items-center tw-flex-wrap tw-gap-1" id="repo-topics"> {{range .Topics}}<a class="ui repo-topic large label topic gt-m-0" href="{{AppSubUrl}}/explore/repos?q={{.Name}}&topic=1">{{.Name}}</a>{{end}} diff --git a/templates/shared/search/code/search.tmpl b/templates/shared/search/code/search.tmpl index 0cfd62a1f7..4a9d905b9d 100644 --- a/templates/shared/search/code/search.tmpl +++ b/templates/shared/search/code/search.tmpl @@ -11,9 +11,16 @@ <div class="ui error message"> <p>{{ctx.Locale.Tr "search.code_search_unavailable"}}</p> </div> - {{else if .SearchResults}} - {{template "shared/search/code/results" .}} - {{else if .Keyword}} - <div>{{ctx.Locale.Tr "search.no_results"}}</div> + {{else}} + {{if not .CodeIndexerEnabled}} + <div class="ui message"> + <p>{{ctx.Locale.Tr "search.code_search_by_git_grep"}}</p> + </div> + {{end}} + {{if .SearchResults}} + {{template "shared/search/code/results" .}} + {{else if .Keyword}} + <div>{{ctx.Locale.Tr "search.no_results"}}</div> + {{end}} {{end}} </div> diff --git a/templates/shared/searchbottom.tmpl b/templates/shared/searchbottom.tmpl index 43d6092e8d..b22324585c 100644 --- a/templates/shared/searchbottom.tmpl +++ b/templates/shared/searchbottom.tmpl @@ -1,3 +1,4 @@ +{{if or .result.Language (not .result.UpdatedUnix.IsZero)}} <div class="ui bottom attached table segment tw-flex tw-items-center tw-justify-between"> <div class="tw-flex tw-items-center gt-ml-4"> {{if .result.Language}} @@ -10,3 +11,4 @@ {{end}} </div> </div> +{{end}} |