diff options
author | Vincent Ambo <tazjin@gmail.com> | 2018-04-14T20·06+0200 |
---|---|---|
committer | Vincent Ambo <github@tazj.in> | 2018-04-14T20·21+0200 |
commit | 4132869277656437f1f62869a2b1676d4c1c42d7 (patch) | |
tree | 6ee6a8302e4712bc8aca47e8c021063ad338b0bf /templates | |
parent | dae97fdaf5a9541895d9719f1f58902cca846e2b (diff) |
feat: Implement search result view & enable search
Implements a very simple and currently kinda broken-looking search result view.
Diffstat (limited to 'templates')
-rw-r--r-- | templates/index.html | 6 | ||||
-rw-r--r-- | templates/search.html | 48 |
2 files changed, 51 insertions, 3 deletions
diff --git a/templates/index.html b/templates/index.html index 35cfeba05023..263c8828a038 100644 --- a/templates/index.html +++ b/templates/index.html @@ -14,9 +14,9 @@ <a class="navbar-brand" href="/"> <h2>Converse</h2> </a> - <form class="form-inline"> - <input class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Search" disabled> - <button class="btn btn-outline-success my-2 my-sm-0 mr-1" type="submit" disabled>Search</button> + <form class="form-inline" method="post" action="/search"> + <input class="form-control mr-sm-2" type="search" placeholder="Search" name="query" aria-label="Search"> + <button class="btn btn-outline-success my-2 my-sm-0 mr-1" type="submit">Search</button> <a class="btn btn-outline-secondary my-2" href="/thread/new">New thread</a> </form> </nav> diff --git a/templates/search.html b/templates/search.html new file mode 100644 index 000000000000..95384b1caf58 --- /dev/null +++ b/templates/search.html @@ -0,0 +1,48 @@ +<!doctype html> +<html lang="en"> + <head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> + <meta http-equiv="Content-Security-Policy" content="script-src 'self';"> + <!-- Bootstrap CSS --> + <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous"> + <title>Converse Index</title> + </head> + <body> + <header> + <nav class="navbar navbar-light bg-light justify-content-between mb-3"> + <a class="navbar-brand" href="/"> + <h2>Converse</h2> + </a> + <form class="form-inline" method="post" action="/search"> + <input class="form-control mr-sm-2" type="search" placeholder="Search" name="query" aria-label="Search"> + <button class="btn btn-outline-success my-2 my-sm-0 mr-1" type="submit">Search</button> + <a class="btn btn-outline-secondary my-2" href="/thread/new">New thread</a> + <a class="btn btn-outline-secondary my-2" href="/">Back to index</a> + </form> + </nav> + </header> + <div class="container"> + <div class="row"> + <div class="col-4"> + <h2>Search results for '{{ query }}':</h2> + </div> + </div> + <div class="row"> + <div class="col-12"> + <div class="list-group"> + {% for result in results -%} + <a href="/thread/{{ result.thread_id }}#post-{{ result.post_id }}" class="list-group-item flex-column list-group-item-action align-items-start"> + <div class="d-flex w-100 justify-content-between"> + <h5 class="mb-1">In thread '{{ result.title }}':</h5> + <div>{{ result.headline }}</div> + <div>(Posted by <i>{{ result.author }})</i></div> + </div> + </a> + {%- endfor %} + </div> + </div> + </div> + </div> + </body> +</html> |