gitea源码

combo.tmpl 1.3KB

12345678910111213141516171819202122232425262728293031
  1. {{/* Attributes:
  2. * Value - value of the search field (for search results page)
  3. * Disabled (optional) - if search field/button has to be disabled
  4. * Placeholder (optional) - placeholder text to be used
  5. * Tooltip (optional) - a tooltip to be displayed on button hover
  6. * SearchModes - a list of search modes to be displayed in the dropdown
  7. * SelectedSearchMode - the currently selected search mode
  8. */}}
  9. <div class="ui small fluid action input">
  10. {{template "shared/search/input" dict "Value" .Value "Disabled" .Disabled "Placeholder" .Placeholder}}
  11. {{if .SearchModes}}
  12. <div class="ui small dropdown selection {{if .Disabled}}disabled{{end}}" data-tooltip-content="{{ctx.Locale.Tr "search.type_tooltip"}}">
  13. <div class="text"></div> {{svg "octicon-triangle-down" 14 "dropdown icon"}}
  14. <input name="search_mode" type="hidden" value="
  15. {{- if .SelectedSearchMode -}}
  16. {{- .SelectedSearchMode -}}
  17. {{- else -}}
  18. {{- $defaultSearchMode := index .SearchModes 0 -}}
  19. {{- $defaultSearchMode.ModeValue -}}
  20. {{- end -}}
  21. ">
  22. <div class="menu">
  23. {{range $mode := .SearchModes}}
  24. <div class="item" data-value="{{$mode.ModeValue}}" data-tooltip-content="{{ctx.Locale.Tr $mode.TooltipTrKey}}">{{ctx.Locale.Tr $mode.TitleTrKey}}</div>
  25. {{end}}
  26. </div>
  27. </div>
  28. {{end}}
  29. {{template "shared/search/button" dict "Disabled" .Disabled "Tooltip" .Tooltip}}
  30. </div>