diff options
author | Andrew Godwin | 2022-11-15 18:30:30 -0700 |
---|---|---|
committer | Andrew Godwin | 2022-11-15 15:30:32 -0700 |
commit | 20e63023bb0d3c7e4cb36b91b73e79f51889cc90 (patch) | |
tree | 96c99139f03550e35902440cd321290bc47f8f0f /templates | |
parent | 4aa92744aea6097ffb784ca7de6bd95cc599988d (diff) | |
download | takahe-20e63023bb0d3c7e4cb36b91b73e79f51889cc90.tar.gz takahe-20e63023bb0d3c7e4cb36b91b73e79f51889cc90.tar.bz2 takahe-20e63023bb0d3c7e4cb36b91b73e79f51889cc90.zip |
Get outbound likes/boosts and their undos working
Diffstat (limited to 'templates')
-rw-r--r-- | templates/activities/_boost.html | 35 | ||||
-rw-r--r-- | templates/activities/_like.html | 9 | ||||
-rw-r--r-- | templates/activities/_post.html | 7 | ||||
-rw-r--r-- | templates/activities/post.html | 17 | ||||
-rw-r--r-- | templates/base.html | 3 |
5 files changed, 43 insertions, 28 deletions
diff --git a/templates/activities/_boost.html b/templates/activities/_boost.html index 601466e..8e90045 100644 --- a/templates/activities/_boost.html +++ b/templates/activities/_boost.html @@ -1,28 +1,9 @@ -{% load static %} -{% load activity_tags %} -<div class="post"> - - {% if post.author.icon_uri %} - <img src="{{post.author.icon_uri}}" class="icon"> - {% else %} - <img src="{% static "img/unknown-icon-128.png" %}" class="icon"> - {% endif %} - - <time> - <a href="{{ post.url }}"> - {% if post.published %} - {{ post.published | timedeltashort }} - {% else %} - {{ post.created | timedeltashort }} - {% endif %} - </a> - </time> - - <a href="{{ post.author.urls.view }}" class="handle"> - {{ post.author.name_or_handle }} <small>@{{ post.author.handle }}</small> +{% if post.pk in interactions.boost %} + <a title="Unboost" class="active" hx-post="{{ post.urls.action_unboost }}" hx-swap="outerHTML"> + <i class="fa-solid fa-retweet"></i> </a> - - <div class="content"> - {{ post.safe_content }} - </div> -</div> +{% else %} + <a title="Boost" hx-post="{{ post.urls.action_boost }}" hx-swap="outerHTML"> + <i class="fa-solid fa-retweet"></i> + </a> +{% endif %} diff --git a/templates/activities/_like.html b/templates/activities/_like.html new file mode 100644 index 0000000..8eec8cd --- /dev/null +++ b/templates/activities/_like.html @@ -0,0 +1,9 @@ +{% if post.pk in interactions.like %} + <a title="Unlike" class="active" hx-post="{{ post.urls.action_unlike }}" hx-swap="outerHTML"> + <i class="fa-solid fa-star"></i> + </a> +{% else %} + <a title="Like" hx-post="{{ post.urls.action_like }}" hx-swap="outerHTML"> + <i class="fa-solid fa-star"></i> + </a> +{% endif %} diff --git a/templates/activities/_post.html b/templates/activities/_post.html index bf4b189..ac21c42 100644 --- a/templates/activities/_post.html +++ b/templates/activities/_post.html @@ -25,4 +25,11 @@ <div class="content"> {{ post.safe_content }} </div> + + {% if request.identity %} + <div class="actions"> + {% include "activities/_like.html" %} + {% include "activities/_boost.html" %} + </div> + {% endif %} </div> diff --git a/templates/activities/post.html b/templates/activities/post.html new file mode 100644 index 0000000..b44df40 --- /dev/null +++ b/templates/activities/post.html @@ -0,0 +1,17 @@ +{% extends "base.html" %} + +{% 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> +{% endblock %} diff --git a/templates/base.html b/templates/base.html index d50fdcf..e465f05 100644 --- a/templates/base.html +++ b/templates/base.html @@ -9,9 +9,10 @@ <link rel="stylesheet" href="{% static "fonts/raleway/raleway.css" %}" type="text/css" /> <link rel="stylesheet" href="{% static "fonts/font_awesome/all.min.css" %}" type="text/css" /> <script src="{% static "js/hyperscript.min.js" %}"></script> + <script src="{% static "js/htmx.min.js" %}"></script> {% block extra_head %}{% endblock %} </head> -<body class="{% block body_class %}{% endblock %}"> +<body class="{% block body_class %}{% endblock %}" hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'> <main> <header> |