make it sleeker

master
Aevann 2024-11-12 19:01:58 +02:00
parent 3e218ff317
commit 04fbb2f014
2 changed files with 12 additions and 2 deletions

View File

@ -53,6 +53,10 @@ def searchparse(text):
def searchposts(v):
query = request.values.get("q", '').strip()
author = request.values.get('author')
if author:
return redirect(f"/search/posts?q=author:{author} {query}")
criteria = searchparse(query)
if 'post' in criteria:
@ -197,6 +201,10 @@ def searchposts(v):
def searchcomments(v):
query = request.values.get("q", '').strip()
author = request.values.get('author')
if author:
return redirect(f"/search/comments?q=author:{author} {query}")
page = get_page()
sort = request.values.get("sort", "new").lower()

View File

@ -39,8 +39,10 @@
</div>
</div>
<form id="searchform" class="form-inline search flex-nowrap mt-3" action="/search/{{request.path.split('/')[-1]}}" method="get">
<input autocomplete="off" class="form-control w-100" type="search" placeholder="Search" value="author:{{u.username}} " name="q">
{% set kind = request.path.split('/')[-1] %}
<form id="searchform" class="form-inline search flex-nowrap mt-3" action="/search/{{kind}}" method="get">
<input hidden name="author" value="{{u.username}}">
<input autocomplete="off" class="form-control w-100" type="search" placeholder="Search user's {{kind}}" name="q">
<span class="input-group-append">
<span class="input-group-text border-0 bg-transparent" style="margin-left: -2.5rem">
<button type="submit" class="fas fa-search text-muted"></button>