diff --git a/brutaldon/templates/main/boost.html b/brutaldon/templates/main/boost.html new file mode 100644 index 0000000..90e6dbb --- /dev/null +++ b/brutaldon/templates/main/boost.html @@ -0,0 +1,31 @@ +{% extends "base.html" %} + +{% block title %} Brutaldon - confirm boost {% endblock %} + +{% block content %} + {% if toot.reblogged %} +

Unboost that toot?

+ {% else %} +

Boost that toot?

+ {% endif %} + +
+ {% include "main/toot_partial.html" with toot=toot %} +
+
+ {% csrf_token %} +
+
+
+ +
+
+
+
+ +
+
+
+
+{% endblock %} diff --git a/brutaldon/templates/main/toot_partial.html b/brutaldon/templates/main/toot_partial.html index 0e5ac09..a6896d4 100644 --- a/brutaldon/templates/main/toot_partial.html +++ b/brutaldon/templates/main/toot_partial.html @@ -68,10 +68,16 @@ - - + + + {% if toot.reblogged %} + + {% else %} + + {% endif %} - + + diff --git a/brutaldon/urls.py b/brutaldon/urls.py index c3277c7..41f73dd 100644 --- a/brutaldon/urls.py +++ b/brutaldon/urls.py @@ -31,5 +31,6 @@ urlpatterns = [ path('toot', views.toot, name="toot"), path('reply/', views.reply, name='reply'), path('fav/', views.fav, name='fav'), + path('boost/', views.boost, name='boost'), path('', views.home), ] diff --git a/brutaldon/views.py b/brutaldon/views.py index 1da6cac..accc028 100644 --- a/brutaldon/views.py +++ b/brutaldon/views.py @@ -206,3 +206,15 @@ def fav(request, id): return redirect(thread, id) else: return render(request, 'main/fav.html', {"toot": toot}) + +def boost(request, id): + mastodon = get_mastodon(request) + toot = mastodon.status(id) + if request.method == 'POST': + if toot.reblogged: + mastodon.status_unreblog(id) + else: + mastodon.status_reblog(id) + return redirect(thread, id) + else: + return render(request, 'main/boost.html', {"toot": toot})