| 3f4b0ea6 Andy McCall ↶ |
1 |
{% extends "base.html" %} |
| 2 |
{% import "repo_tabs.html" as m %} |
| 3 |
{% block title %}Search {{ q }} · {{ repo.owner }}/{{ repo.name }}{% endblock %} |
| 4 |
{% block bodyattrs %} data-repo="{{ repo.url }}"{% endblock %} |
| 5 |
{% block tabs %}{% call m::tabs(repo, "code") %}{% endblock %} |
| 6 |
{% block mainclass %} class="wide"{% endblock %} |
| 7 |
{% block content %} |
| 8 |
<div class="head"><h1>Search code <small>on ◆ {{ r }}{% if !q.is_empty() %} · {{ results.hits.len() }} matches in {{ results.files|plural("file", "files") }}{% if results.truncated %} (stopped early; narrow the search){% endif %}{% endif %}</small></h1></div> |
| 9 |
<form class="card wide" method="get" action="{{ repo.url }}/search"> |
| 10 |
<div class="row"> |
| 11 |
<div><input type="search" name="q" value="{{ q }}" autofocus placeholder="text, or a regular expression"></div> |
| 12 |
<div><input type="text" name="path" value="{{ path }}" placeholder="under path (optional)"></div> |
| 13 |
<div><button type="submit">SEARCH</button></div> |
| 14 |
</div> |
| 15 |
<input type="hidden" name="ref" value="{{ r }}"> |
| 16 |
<div class="choice"><label><input type="checkbox" name="re" value="1"{% if regex %} checked{% endif %}> regular expression</label><label><input type="checkbox" name="case" value="1"{% if case %} checked{% endif %}> match case</label></div> |
| 17 |
</form> |
| 18 |
{% if let Some(e) = error %}<p class="error">{{ e }}</p>{% endif %} |
| 19 |
{% if !q.is_empty() && results.hits.is_empty() && error.is_none() %}<p class="empty">Nothing matches.</p>{% endif %} |
| 20 |
<div class="hits"> |
| 21 |
{% for h in results.hits %} |
| 22 |
{% if h.line == 0 %}<p class="hit"><a href="{{ repo.url }}/file/{{ r }}/{{ h.path }}"><strong>{{ h.path }}</strong></a> <span class="small mute">path matches</span></p> |
| 23 |
{% else %}<p class="hit"><a href="{{ repo.url }}/file/{{ r }}/{{ h.path }}#L{{ h.line }}"><span class="mute">{{ h.path }}:{{ h.line }}</span></a> <code>{{ h.text }}</code></p>{% endif %} |
| 24 |
{% endfor %} |
| 25 |
</div> |
| 26 |
{% endblock %} |