first-commit

This commit is contained in:
2025-08-25 15:46:12 +08:00
commit f4d95dfff4
5665 changed files with 705359 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
{{/* Disable (optional) - if search button has to be disabled */}}
{{/* Tooltip (optional) - a tooltip to be displayed on hover */}}
<button class="ui small icon button" aria-label="{{ctx.Locale.Tr "search.search"}}" {{with .Tooltip}}data-tooltip-content="{{.}}"{{end}}{{if .Disabled}} disabled{{end}}>{{svg "octicon-search"}}</button>

View File

@@ -0,0 +1,36 @@
<div class="flex-text-block tw-flex-wrap">
{{range $term := .SearchResultLanguages}}
<a class="ui {{if eq $.Language $term.Language}}primary{{end}} basic label tw-m-0"
href="?q={{$.Keyword}}{{if ne $.Language $term.Language}}&l={{$term.Language}}{{end}}&search_mode={{$.SelectedSearchMode}}">
<i class="color-icon tw-mr-2" style="background-color: {{$term.Color}}"></i>
{{$term.Language}}
<div class="detail">{{$term.Count}}</div>
</a>
{{end}}
</div>
<div class="repository search">
{{range $result := .SearchResults}}
{{$repo := or $.Repo (index $.RepoMaps .RepoID)}}
<div class="diff-file-box file-content non-diff-file-content repo-search-result">
<h4 class="ui top attached header tw-font-normal tw-flex tw-flex-wrap">
{{if not $.Repo}}
<span class="file tw-flex-1">
<a rel="nofollow" href="{{$repo.Link}}">{{$repo.FullName}}</a>
{{if $repo.IsArchived}}
<span class="ui basic label">{{ctx.Locale.Tr "repo.desc.archived"}}</span>
{{end}}
- {{.Filename}}
</span>
{{else}}
<span class="file tw-flex-1">{{.Filename}}</span>
{{end}}
<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>
<div class="ui attached table segment">
{{template "shared/searchfile" dict "RepoLink" $repo.Link "SearchResult" .}}
</div>
{{template "shared/searchbottom" dict "root" $ "result" .}}
</div>
{{end}}
</div>
{{template "base/paginate" .}}

View File

@@ -0,0 +1,29 @@
<form class="ui form ignore-dirty">
{{template "shared/search/combo" (dict
"Disabled" .CodeIndexerUnavailable
"Value" .Keyword
"Placeholder" (ctx.Locale.Tr "search.code_kind")
"SearchModes" .SearchModes
"SelectedSearchMode" .SelectedSearchMode
)}}
</form>
<div class="divider"></div>
<div class="ui list">
{{template "base/alert" .}}
{{if .CodeIndexerUnavailable}}
<div class="ui error message">
<p>{{ctx.Locale.Tr "search.code_search_unavailable"}}</p>
</div>
{{else}}
{{if not .IsRepoIndexerEnabled}}
<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>

View File

@@ -0,0 +1,30 @@
{{/* Attributes:
* Value - value of the search field (for search results page)
* Disabled (optional) - if search field/button has to be disabled
* Placeholder (optional) - placeholder text to be used
* Tooltip (optional) - a tooltip to be displayed on button hover
* SearchModes - a list of search modes to be displayed in the dropdown
* SelectedSearchMode - the currently selected search mode
*/}}
<div class="ui small fluid action input">
{{template "shared/search/input" dict "Value" .Value "Disabled" .Disabled "Placeholder" .Placeholder}}
{{if .SearchModes}}
<div class="ui small dropdown selection {{if .Disabled}}disabled{{end}}" data-tooltip-content="{{ctx.Locale.Tr "search.type_tooltip"}}">
<div class="text"></div> {{svg "octicon-triangle-down" 14 "dropdown icon"}}
<input name="search_mode" type="hidden" value="
{{- if .SelectedSearchMode -}}
{{- .SelectedSearchMode -}}
{{- else -}}
{{- $defaultSearchMode := index .SearchModes 0 -}}
{{- $defaultSearchMode.ModeValue -}}
{{- end -}}
">
<div class="menu">
{{range $mode := .SearchModes}}
<div class="item" data-value="{{$mode.ModeValue}}" data-tooltip-content="{{ctx.Locale.Tr $mode.TooltipTrKey}}">{{ctx.Locale.Tr $mode.TitleTrKey}}</div>
{{end}}
</div>
</div>
{{end}}
{{template "shared/search/button" dict "Disabled" .Disabled "Tooltip" .Tooltip}}
</div>

View File

@@ -0,0 +1,4 @@
{{/* Value - value of the search field (for search results page) */}}
{{/* Disabled (optional) - if search field has to be disabled */}}
{{/* Placeholder (optional) - placeholder text to be used */}}
<input type="search" name="q"{{with .Value}} value="{{.}}"{{end}} maxlength="255" spellcheck="false" placeholder="{{with .Placeholder}}{{.}}{{else}}{{ctx.Locale.Tr "search.search"}}{{end}}"{{if .Disabled}} disabled{{end}}>