A bit more on search templates
This commit is contained in:
parent
f2c8036bc0
commit
5e2b025042
|
@ -0,0 +1,35 @@
|
||||||
|
{% extends "base.html" %}
|
||||||
|
{% load widget_tweaks %}
|
||||||
|
|
||||||
|
{% block title %}brutaldon – search {% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<h1 class="title">Search</h1>
|
||||||
|
|
||||||
|
<div class="notification">
|
||||||
|
<div>
|
||||||
|
You can search for tags, users, or for specific toots by URL. You may
|
||||||
|
also be able to full-text search for toots you have previously
|
||||||
|
interacted with.
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<form method="get" action="{% url "search_results" %}">
|
||||||
|
{% csrf_token %}
|
||||||
|
<div class="field">
|
||||||
|
<label class="label">{{ form.instance.label }}</label>
|
||||||
|
<div class="control has-icons-left">
|
||||||
|
<input type="search" name="q" id="q" class="input">
|
||||||
|
<span class="icon is-small is-left">
|
||||||
|
<i class="fa fa-search"></i>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="field">
|
||||||
|
<input type="submit" name="search"
|
||||||
|
value="Search" class="button is-primary" >
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
{% endblock %}
|
|
@ -0,0 +1,30 @@
|
||||||
|
{% extends "base.html" %}
|
||||||
|
{% load humanize %}
|
||||||
|
{% load taglinks %}
|
||||||
|
|
||||||
|
{% block title %}
|
||||||
|
Brutaldon - search results
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% comment %}
|
||||||
|
mastodon.search("<query>")
|
||||||
|
# Returns the following dictionary
|
||||||
|
{
|
||||||
|
'accounts': # List of account dicts resulting from the query
|
||||||
|
'hashtags': # List of hashtag dicts resulting from the query
|
||||||
|
'statuses': # List of toot dicts resulting from the query
|
||||||
|
}
|
||||||
|
|
||||||
|
{% endcomment %}
|
||||||
|
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<h1 class="title">Search results</h1>
|
||||||
|
|
||||||
|
<h2 class="subtitle">Users</h2>
|
||||||
|
|
||||||
|
|
||||||
|
<h2 class="subtitle">Tags</h2>
|
||||||
|
|
||||||
|
<h2 class="subtitle">Toots</h2>
|
||||||
|
{% endblock %}
|
|
@ -419,7 +419,7 @@ def delete(request, id):
|
||||||
|
|
||||||
|
|
||||||
def search(request):
|
def search(request):
|
||||||
return render(request, 'search.html',
|
return render(request, 'main/search.html',
|
||||||
{"fullbrutalism": fullbrutalism_p(request)})
|
{"fullbrutalism": fullbrutalism_p(request)})
|
||||||
|
|
||||||
def search_results(request):
|
def search_results(request):
|
||||||
|
@ -431,7 +431,7 @@ def search_results(request):
|
||||||
query = ''
|
query = ''
|
||||||
mastodon = get_mastodon(request)
|
mastodon = get_mastodon(request)
|
||||||
results = mastodon.search(query)
|
results = mastodon.search(query)
|
||||||
return render(request, 'search_results.html',
|
return render(request, 'main/search_results.html',
|
||||||
{"results": results,
|
{"results": results,
|
||||||
"fullbrutalism": fullbrutalism_p(request)})
|
"fullbrutalism": fullbrutalism_p(request)})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue