diff options
author | Andrew Godwin | 2022-11-17 18:52:00 -0700 |
---|---|---|
committer | Andrew Godwin | 2022-11-17 15:10:09 -0700 |
commit | 0851fbd1ec09b142608667bf90ee806e59cafb28 (patch) | |
tree | eb4bfa7e52ef0a66460840747ea83b7685e1a5e8 /templates | |
parent | 2154e6f02252576d8652e66f26fa4ae635d0f8ee (diff) | |
download | takahe-0851fbd1ec09b142608667bf90ee806e59cafb28.tar.gz takahe-0851fbd1ec09b142608667bf90ee806e59cafb28.tar.bz2 takahe-0851fbd1ec09b142608667bf90ee806e59cafb28.zip |
Add search and better notifications
Diffstat (limited to 'templates')
-rw-r--r-- | templates/activities/_event.html | 48 | ||||
-rw-r--r-- | templates/activities/_identity.html | 15 | ||||
-rw-r--r-- | templates/activities/_menu.html (renamed from templates/activities/_home_menu.html) | 1 | ||||
-rw-r--r-- | templates/activities/_post.html | 5 | ||||
-rw-r--r-- | templates/activities/post.html | 12 | ||||
-rw-r--r-- | templates/activities/search.html | 21 | ||||
-rw-r--r-- | templates/base.html | 6 | ||||
-rw-r--r-- | templates/identity/view.html | 20 |
8 files changed, 73 insertions, 55 deletions
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 %} -<div class="post"> - <time> - {% if event.published %} - {{ event.published | timedeltashort }} - {% else %} - {{ event.created | timedeltashort }} - {% endif %} - </time> - - {% 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 %} -</div> +{% if event.type == "followed" %} + <div class="follow-banner"> + <a href="{{ event.subject_identity.urls.view }}"> + {{ event.subject_identity.name_or_handle }} + </a> followed you + </div> + {% include "activities/_identity.html" with identity=event.subject_identity created=event.created %} +{% elif event.type == "liked" %} + <div class="like-banner"> + <a href="{{ event.subject_identity.urls.view }}"> + {{ event.subject_identity.name_or_handle }} + </a> liked your post + </div> + {% include "activities/_post.html" with post=event.subject_post %} +{% elif event.type == "mentioned" %} + <div class="mention-banner"> + <a href="{{ event.subject_identity.urls.view }}"> + {{ event.subject_identity.name_or_handle }} + </a> mentioned you + </div> + {% 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/_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 %} +<div class="post user"> + + <img src="{{ identity.local_icon_url }}" class="icon"> + + {% if created %} + <time> + {{ event.created | timedeltashort }} + </time> + {% endif %} + + <a href="{{ identity.urls.view }}" class="handle"> + {{ identity.name_or_handle }} <small>@{{ identity.handle }}</small> + </a> +</div> diff --git a/templates/activities/_home_menu.html b/templates/activities/_menu.html index db441a2..6bb18c2 100644 --- a/templates/activities/_home_menu.html +++ b/templates/activities/_menu.html @@ -19,6 +19,7 @@ {% csrf_token %} {{ form.text }} {{ form.content_warning }} + <input type="hidden" name="visibility" value="0"> <div class="buttons"> <span class="button toggle" _="on click toggle .enabled then toggle .hidden on #id_content_warning">CW</span> <button>{% if config_identity.toot_mode %}Toot!{% else %}Post{% endif %}</button> 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 @@ <div class="actions"> {% include "activities/_like.html" %} {% include "activities/_boost.html" %} - {% if request.user.admin %} - <a title="Admin" href="/djadmin/activities/post/{{ post.pk }}/change/"> - <i class="fa-solid fa-file-code"></i> - </a> - {% endif %} </div> {% endif %} </div> 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 %} - <nav> - <a href="." class="selected">Post</a> - </nav> - - <section class="columns"> - - <div class="left-column"> - {% include "activities/_post.html" %} - </div> - - </section> + {% 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 %} + <form action="." method="POST"> + {% csrf_token %} + <fieldset> + {% include "forms/_field.html" with field=form.query %} + </fieldset> + <div class="buttons"> + <button>Search</button> + </div> + </form> + {% if results.identities %} + <h2>People</h2> + {% for identity in results.identities %} + {% include "activities/_identity.html" %} + {% endfor %} + {% endif %} +{% endblock %} diff --git a/templates/base.html b/templates/base.html index 31bbc7b..edcb11a 100644 --- a/templates/base.html +++ b/templates/base.html @@ -28,10 +28,10 @@ </a> <menu> {% if user.is_authenticated %} - <a href="/compose/" title="Compose" {% if top_section == "compose" %}class="selected"{% endif %}> + <a href="{% url "compose" %}" title="Compose" {% if top_section == "compose" %}class="selected"{% endif %}> <i class="fa-solid fa-feather"></i> Compose </a> - <a href="#" title="Search" {% if top_section == "search" %}class="selected"{% endif %}> + <a href="{% url "search" %}" title="Search" {% if top_section == "search" %}class="selected"{% endif %}> <i class="fa-solid fa-search"></i> Search </a> <a href="{% url "settings" %}" title="Settings" {% if top_section == "settings" %}class="selected"{% endif %}> @@ -67,7 +67,7 @@ </div> <div class="right-column"> {% block right_content %} - {% include "activities/_home_menu.html" %} + {% include "activities/_menu.html" %} {% endblock %} </div> </div> diff --git a/templates/identity/view.html b/templates/identity/view.html index c830fc5..0dd0592 100644 --- a/templates/identity/view.html +++ b/templates/identity/view.html @@ -1,17 +1,13 @@ {% extends "base.html" %} -{% load static %} {% block title %}{{ identity }}{% endblock %} {% block content %} - <nav> - <a href="." class="selected">Profile</a> - </nav> - <h1 class="identity"> {% if identity.local_image_url %} <img src="{{ identity.local_image_url }}" class="banner"> {% endif %} + <img src="{{ identity.local_icon_url }}" class="icon"> {% if request.identity %} @@ -43,13 +39,9 @@ {% endif %} {% endif %} - <section class="columns"> - <div class="left-column"> - {% for post in posts %} - {% include "activities/_post.html" %} - {% empty %} - No posts yet. - {% endfor %} - </div> - </section> + {% for post in posts %} + {% include "activities/_post.html" %} + {% empty %} + No posts yet. + {% endfor %} {% endblock %} |