From 0851fbd1ec09b142608667bf90ee806e59cafb28 Mon Sep 17 00:00:00 2001 From: Andrew Godwin Date: Thu, 17 Nov 2022 18:52:00 -0700 Subject: Add search and better notifications --- templates/activities/_event.html | 48 +++++++++++++++++++----------------- templates/activities/_home_menu.html | 27 -------------------- templates/activities/_identity.html | 15 +++++++++++ templates/activities/_menu.html | 28 +++++++++++++++++++++ templates/activities/_post.html | 5 ---- templates/activities/post.html | 12 +-------- templates/activities/search.html | 21 ++++++++++++++++ 7 files changed, 91 insertions(+), 65 deletions(-) delete mode 100644 templates/activities/_home_menu.html create mode 100644 templates/activities/_identity.html create mode 100644 templates/activities/_menu.html create mode 100644 templates/activities/search.html (limited to 'templates/activities') diff --git a/templates/activities/_event.html b/templates/activities/_event.html index 375e475..81e9dd2 100644 --- a/templates/activities/_event.html +++ b/templates/activities/_event.html @@ -1,24 +1,28 @@ -{% load static %} {% load activity_tags %} -
- - - {% if event.type == "follow" %} - {{ event.subject_identity.name_or_handle }} followed you - {% elif event.type == "like" %} - {{ event.subject_identity.name_or_handle }} liked {{ event.subject_post }} - {% elif event.type == "mentioned" %} - {{ event.subject_post.author.name_or_handle }} mentioned you in {{ event.subject_post }} - {% elif event.type == "boosted" %} - {{ event.subject_identity.name_or_handle }} boosted your post {{ event.subject_post }} - {% else %} - Unknown event type {{event.type}} - {% endif %} -
+{% if event.type == "followed" %} +
+ + {{ event.subject_identity.name_or_handle }} + followed you +
+ {% include "activities/_identity.html" with identity=event.subject_identity created=event.created %} +{% elif event.type == "liked" %} +
+ + {{ event.subject_identity.name_or_handle }} + liked your post +
+ {% include "activities/_post.html" with post=event.subject_post %} +{% elif event.type == "mentioned" %} +
+ + {{ event.subject_identity.name_or_handle }} + mentioned you +
+ {% include "activities/_post.html" with post=event.subject_post %} +{% elif event.type == "boosted" %} + {{ event.subject_identity.name_or_handle }} boosted your post {{ event.subject_post }} +{% else %} + Unknown event type {{event.type}} +{% endif %} diff --git a/templates/activities/_home_menu.html b/templates/activities/_home_menu.html deleted file mode 100644 index db441a2..0000000 --- a/templates/activities/_home_menu.html +++ /dev/null @@ -1,27 +0,0 @@ - - -{% if current_page == "home" %} -

Compose

-
- {% csrf_token %} - {{ form.text }} - {{ form.content_warning }} -
- CW - -
-
-{% endif %} diff --git a/templates/activities/_identity.html b/templates/activities/_identity.html new file mode 100644 index 0000000..36d14a9 --- /dev/null +++ b/templates/activities/_identity.html @@ -0,0 +1,15 @@ +{% load activity_tags %} +
+ + + + {% if created %} + + {% endif %} + + + {{ identity.name_or_handle }} @{{ identity.handle }} + +
diff --git a/templates/activities/_menu.html b/templates/activities/_menu.html new file mode 100644 index 0000000..6bb18c2 --- /dev/null +++ b/templates/activities/_menu.html @@ -0,0 +1,28 @@ + + +{% if current_page == "home" %} +

Compose

+
+ {% csrf_token %} + {{ form.text }} + {{ form.content_warning }} + +
+ CW + +
+
+{% endif %} diff --git a/templates/activities/_post.html b/templates/activities/_post.html index 14b1cbf..5de8bc7 100644 --- a/templates/activities/_post.html +++ b/templates/activities/_post.html @@ -51,11 +51,6 @@
{% include "activities/_like.html" %} {% include "activities/_boost.html" %} - {% if request.user.admin %} - - - - {% endif %}
{% endif %} diff --git a/templates/activities/post.html b/templates/activities/post.html index b44df40..eee254f 100644 --- a/templates/activities/post.html +++ b/templates/activities/post.html @@ -3,15 +3,5 @@ {% block title %}Post by {{ post.author.name_or_handle }}{% endblock %} {% block content %} - - -
- -
- {% include "activities/_post.html" %} -
- -
+ {% include "activities/_post.html" %} {% endblock %} diff --git a/templates/activities/search.html b/templates/activities/search.html new file mode 100644 index 0000000..3cff2a2 --- /dev/null +++ b/templates/activities/search.html @@ -0,0 +1,21 @@ +{% extends "base.html" %} + +{% block title %}Search{% endblock %} + +{% block content %} +
+ {% csrf_token %} +
+ {% include "forms/_field.html" with field=form.query %} +
+
+ +
+
+ {% if results.identities %} +

People

+ {% for identity in results.identities %} + {% include "activities/_identity.html" %} + {% endfor %} + {% endif %} +{% endblock %} -- cgit v1.2.3