From cce0fe0186f24c87c2c5a58f6f8cbab18189136f Mon Sep 17 00:00:00 2001 From: Jason McBrayer Date: Sat, 9 Jun 2018 13:49:04 -0400 Subject: [PATCH] Complete searching feature for brutaldon --- brutaldon/static/css/brutaldon.css | 12 ++++ brutaldon/templates/base.html | 3 + brutaldon/templates/main/search.html | 4 +- brutaldon/templates/main/search_results.html | 62 ++++++++++++++++---- brutaldon/views.py | 1 + 5 files changed, 68 insertions(+), 14 deletions(-) diff --git a/brutaldon/static/css/brutaldon.css b/brutaldon/static/css/brutaldon.css index b89e380..0e9ae9b 100644 --- a/brutaldon/static/css/brutaldon.css +++ b/brutaldon/static/css/brutaldon.css @@ -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; diff --git a/brutaldon/templates/base.html b/brutaldon/templates/base.html index 4b13a96..e3aed12 100644 --- a/brutaldon/templates/base.html +++ b/brutaldon/templates/base.html @@ -35,6 +35,9 @@ Notifications Local Federated + + +
- {% csrf_token %}
@@ -27,8 +26,7 @@
- +
diff --git a/brutaldon/templates/main/search_results.html b/brutaldon/templates/main/search_results.html index 04ce276..1a49225 100644 --- a/brutaldon/templates/main/search_results.html +++ b/brutaldon/templates/main/search_results.html @@ -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("") - # 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 %} -

Search results

+

Search results

+
+

Users

+ {% for user in results.accounts %} +
+
+

+ + + +

+
+
+
+

+ {{ user.display_name }} + + + @{{ user.acct }} + + +

+ {{ user.note | relink_toot | strip_html | safe }} +

+

-

Users

+
+
+
-

Tags

+ {% endfor %} -

Toots

+ +

Tags

+
    + {% for tag in results.hashtags %} +
  • #{{ tag }}
  • + {% endfor %} +
+ +

Toots

+ {% for toot in results.statuses %} + {% include "main/toot_partial.html" with toot=toot reblog=False %} + {% endfor %} +
{% endblock %} diff --git a/brutaldon/views.py b/brutaldon/views.py index 55360bc..9942eff 100644 --- a/brutaldon/views.py +++ b/brutaldon/views.py @@ -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