mirror of
http://git.carcosa.net/jmcbray/brutaldon.git
synced 2024-11-23 15:23:52 -05:00
Enable favoriting toots.
The user flow for this is kind of crap right now; it will get better once some intercooler is applied on top, but will stay the same in lynx and FULLBRUTALISM
This commit is contained in:
parent
882b9db5cc
commit
1b561fa90e
31
brutaldon/templates/main/fav.html
Normal file
31
brutaldon/templates/main/fav.html
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
{% extends "base.html" %}
|
||||||
|
|
||||||
|
{% block title %} Brutaldon - confirm favorite {% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
{% if toot.favourited %}
|
||||||
|
<h1 class="title">Unfav that toot?</h1>
|
||||||
|
{% else %}
|
||||||
|
<h1 class="title" >Fav that toot?</h1>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<div class="box">
|
||||||
|
{% include "main/toot_partial.html" with toot=toot %}
|
||||||
|
</div>
|
||||||
|
<form method="POST" action="{% url "fav" toot.id %}">
|
||||||
|
{% csrf_token %}
|
||||||
|
<div class="level is-mobile">
|
||||||
|
<div class="level-left">
|
||||||
|
<div class="level-item">
|
||||||
|
<input class="button" type="submit" name="cancel" value="Cancel">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="level-right">
|
||||||
|
<div class="level-item">
|
||||||
|
<input class="button is-primary" type="submit" name="fav"
|
||||||
|
value="Favorite">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
{% endblock %}
|
@ -73,10 +73,16 @@
|
|||||||
<span class="is-invisible" >Boost</span>
|
<span class="is-invisible" >Boost</span>
|
||||||
</i></span>
|
</i></span>
|
||||||
</a>
|
</a>
|
||||||
<a class="level-item">
|
<a class="level-item" href="{% url "fav" toot.id %}">
|
||||||
<span class="icon is-small"><i class="fa fa-heart">
|
<span class="icon is-small">
|
||||||
<span class="is-invisible" >Favorite</span>
|
{% if toot.favourited %}
|
||||||
</i></span>
|
<i class="fa fa-heart has-text-warning">
|
||||||
|
{% else %}
|
||||||
|
<i class="fa fa-heart">
|
||||||
|
{% endif %}
|
||||||
|
<span class="is-invisible" >Favorite</span>
|
||||||
|
</i>
|
||||||
|
</span>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="level-right">
|
<div class="level-right">
|
||||||
|
@ -30,5 +30,6 @@ urlpatterns = [
|
|||||||
path('thread/<int:id>', views.thread, name='thread'),
|
path('thread/<int:id>', views.thread, name='thread'),
|
||||||
path('toot', views.toot, name="toot"),
|
path('toot', views.toot, name="toot"),
|
||||||
path('reply/<int:id>', views.reply, name='reply'),
|
path('reply/<int:id>', views.reply, name='reply'),
|
||||||
|
path('fav/<int:id>', views.fav, name='fav'),
|
||||||
path('', views.home),
|
path('', views.home),
|
||||||
]
|
]
|
||||||
|
@ -194,3 +194,15 @@ def reply(request, id):
|
|||||||
'fullbrutalism': fullbrutalism_p(request)})
|
'fullbrutalism': fullbrutalism_p(request)})
|
||||||
else:
|
else:
|
||||||
return redirect(reply, id)
|
return redirect(reply, id)
|
||||||
|
|
||||||
|
def fav(request, id):
|
||||||
|
mastodon = get_mastodon(request)
|
||||||
|
toot = mastodon.status(id)
|
||||||
|
if request.method == 'POST':
|
||||||
|
if toot.favourited:
|
||||||
|
mastodon.status_unfavourite(id)
|
||||||
|
else:
|
||||||
|
mastodon.status_favourite(id)
|
||||||
|
return redirect(thread, id)
|
||||||
|
else:
|
||||||
|
return render(request, 'main/fav.html', {"toot": toot})
|
||||||
|
Loading…
Reference in New Issue
Block a user