mirror of
https://github.com/jfmcbrayer/brutaldon
synced 2024-12-22 21:27:58 +01:00
Complete searching feature for brutaldon
This commit is contained in:
parent
5e2b025042
commit
cce0fe0186
@ -48,6 +48,18 @@ figure.media-left p.image a img
|
||||
background-color: #FFF8DC;
|
||||
}
|
||||
|
||||
article.media .content img
|
||||
{
|
||||
max-height: 1.5rem;
|
||||
max-width: 1.5rem;
|
||||
}
|
||||
|
||||
h2.subtitle
|
||||
{
|
||||
margin-top: 2rem;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 768px) {
|
||||
.media {
|
||||
display: block;
|
||||
|
@ -35,6 +35,9 @@
|
||||
<a class="navbar-item" href="{% url "note" %}">Notifications</a>
|
||||
<a class="navbar-item" href="{% url "local" %}">Local</a>
|
||||
<a class="navbar-item" href="{% url "fed" %}">Federated</a>
|
||||
<a class="navbar-item" href="{% url "search" %}">
|
||||
<span class="fa fa-search"><span class="is-hidden">Search</span></span>
|
||||
</a>
|
||||
</div>
|
||||
<div class="navbar-end" >
|
||||
<a class="navbar-item" href="{% url "settings" %}">Settings</a>
|
||||
|
@ -15,7 +15,6 @@
|
||||
</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">
|
||||
@ -27,8 +26,7 @@
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<input type="submit" name="search"
|
||||
value="Search" class="button is-primary" >
|
||||
<input type="submit" value="Search" class="button is-primary" >
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
@ -1,30 +1,70 @@
|
||||
{% extends "base.html" %}
|
||||
{% load humanize %}
|
||||
{% load taglinks %}
|
||||
{% load sanitizer %}
|
||||
|
||||
{% block title %}
|
||||
Brutaldon - search results
|
||||
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
|
||||
}
|
||||
# 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>
|
||||
<h1 class="title">Search results</h1>
|
||||
<div class="container">
|
||||
<h2 class="subtitle">Users</h2>
|
||||
{% for user in results.accounts %}
|
||||
<article class="media">
|
||||
<figure class="media-left">
|
||||
<p class="image is-64x64">
|
||||
<a href="{% url "user" user.acct %}">
|
||||
<img src="{{ user.avatar }}"
|
||||
alt="">
|
||||
</a>
|
||||
</p>
|
||||
</figure>
|
||||
<div class="media-content">
|
||||
<div class="content">
|
||||
<p>
|
||||
<strong>{{ user.display_name }}</strong>
|
||||
<small>
|
||||
<a href="{% url "user" user.acct %}">
|
||||
@{{ user.acct }}
|
||||
</a>
|
||||
</small>
|
||||
</p>
|
||||
{{ user.note | relink_toot | strip_html | safe }}
|
||||
<p>
|
||||
</p>
|
||||
|
||||
<h2 class="subtitle">Users</h2>
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
|
||||
|
||||
<h2 class="subtitle">Tags</h2>
|
||||
{% endfor %}
|
||||
|
||||
<h2 class="subtitle">Toots</h2>
|
||||
|
||||
<h2 class="subtitle">Tags</h2>
|
||||
<ul>
|
||||
{% for tag in results.hashtags %}
|
||||
<li><a href="{% url 'tag' tag %}">#{{ tag }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
<h2 class="subtitle">Toots</h2>
|
||||
{% for toot in results.statuses %}
|
||||
{% include "main/toot_partial.html" with toot=toot reblog=False %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
@ -7,6 +7,7 @@ from brutaldon.forms import LoginForm, OAuthLoginForm, SettingsForm, PostForm
|
||||
from brutaldon.models import Client, Account
|
||||
from mastodon import Mastodon
|
||||
from urllib import parse
|
||||
from pdb import set_trace
|
||||
|
||||
class NotLoggedInException(Exception):
|
||||
pass
|
||||
|
Loading…
Reference in New Issue
Block a user