| // Copyright 2026 Google Inc. All Rights Reserved. |
| // |
| // Licensed under the Apache License, Version 2.0 (the "License"); |
| // you may not use this file except in compliance with the License. |
| // You may obtain a copy of the License at |
| // |
| // http://www.apache.org/licenses/LICENSE-2.0 |
| // |
| // Unless required by applicable law or agreed to in writing, software |
| // distributed under the License is distributed on an "AS IS" BASIS, |
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| // See the License for the specific language governing permissions and |
| // limitations under the License. |
| {namespace com.google.gitiles.templates.GrepDetail} |
| |
| import * as common from 'com/google/gitiles/templates/Common.soy'; |
| |
| /** |
| * Detail page for file-content search results. |
| */ |
| {template grepDetail stricthtml="false"} |
| {@param title: ?} |
| {@param repositoryName: ?} |
| {@param? menuEntries: ?} |
| {@param? customVariant: ?} |
| {@param breadcrumbs: ?} |
| {@param revision: string} |
| {@param path: string} |
| {@param substring: string} |
| {@param hasSearch: bool} |
| {@param matches: list<?>} |
| |
| {call common.header data="all" /} |
| |
| <form method="GET" class="GrepSearch"> |
| <input type="text" name="s" value="{$substring}" class="GrepSearch-input"> |
| <button type="submit" class="GrepSearch-button"> |
| {msg desc="button text for grep search"}Search{/msg} |
| </button> |
| </form> |
| |
| {if $path} |
| <p class="GrepSearch-path"> |
| {msg desc="search path label"}Searching in{/msg} |
| {sp}<span class="u-monospace">{$path}</span> |
| </p> |
| {/if} |
| |
| {if $hasSearch} |
| {if length($matches)} |
| <ol class="GrepResults"> |
| {for $match in $matches} |
| <li class="GrepResults-item"> |
| <a class="u-monospace" href="{$match.url}"> |
| {$match.path} |
| </a> |
| <pre class="u-pre GrepResults-line"><code class="u-monospace">{$match.lineNumber}: {$match.line}</code></pre> |
| </li> |
| {/for} |
| </ol> |
| {else} |
| <p class="GrepResults-empty"> |
| {msg desc="message shown when grep search has no matches"}No matches.{/msg} |
| </p> |
| {/if} |
| {/if} |
| |
| {call common.footer} |
| {param customVariant: $customVariant /} |
| {/call} |
| {/template} |