Commit d2f1c520 authored by Max Rees's avatar Max Rees

Add simple search page to mirror branch page

parent aa613fa5
......@@ -197,6 +197,7 @@ def page_package(path, _query):
# Don't consider it a complete search if only some combination of the
# following are given in a query.
_BORING_TOGGLES = (
"simple",
"page",
"cs",
"subpkgs",
......
......@@ -18,6 +18,28 @@
# endfor
# endmacro
# macro quicksearch(branch)
<form action="{{ branch }}/-/search" method="get">
<div class="field is-grouped">
<div class="control">
<input name="name" class="input" type="text" placeholder="Package name" value="{{ query["name"] }}">
</div>
<div class="control">
<input name="description" class="input" type="text" placeholder="Description" value="{{ query["description"] }}">
</div>
<div class="control">
<input class="button is-primary" type="submit" value="Search">
</div>
<div class="control">
<a class="button is-light" href="{{ branch }}/-/search">Advanced search</a>
</div>
</div>
<input type="hidden" name="simple" value="on">
<input type="hidden" name="availability" value="on">
</form>
<br>
# endmacro
# macro i_text(id, name)
<div class="field">
<div class="control">
......
......@@ -18,23 +18,7 @@
# block content
<h3 class="title is-3">Recently updated packages</h3>
<form action="{{ branch }}/-/search" method="get">
<div class="field is-grouped">
<div class="control">
<input name="name" class="input" type="text" placeholder="Package name">
</div>
<div class="control">
<input name="description" class="input" type="text" placeholder="Description">
</div>
<div class="control">
<input class="button is-primary" type="submit" value="Search">
</div>
<div class="control">
<a class="button is-light" href="{{ branch }}/-/search">Advanced search</a>
</div>
</div>
</form>
<br>
{{ quicksearch(branch) }}
<table class="table is-bordered is-striped is-hoverable">
<tr>
<th>Name</th>
......
......@@ -9,6 +9,10 @@
# set title = ["Search for packages in ", conf["distro"], branch]|join(" ")
# endif
# set n = pkgs|length
# set simple = query.get("simple")
# if simple and not searched
# set simple = false
# endif
# block breadcrumb
<nav class="breadcrumb is-medium">
......@@ -21,6 +25,7 @@
# endblock
# block content
# if not simple
<div class="columns">
<div class="column is-one-third" id="search-controls">
<form action="{{ branch }}/-/search" method="get">
......@@ -89,10 +94,16 @@
</div>
</form>
</div>
# endif
# if searched
# if not simple
<div class="column">
# endif
<h3 class="title is-3">Search results</h3>
# if simple
{{ quicksearch(branch) }}
# endif
# if pkgs
# if query["page"] == 1
<div class="notification is-success is-light">
......@@ -151,6 +162,8 @@ Displaying the first {{ query["limit"] }}.
<div class="notification is-danger">
No packages matched your search terms.
</div>
# endif
# if not simple
</div>
# endif
# endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment