Polls work with intercooler

This commit is contained in:
Jason McBrayer 2019-07-10 13:25:53 -04:00
parent 3439e8c22e
commit 5b7d4e0b68
2 changed files with 15 additions and 2 deletions

View File

@ -2,7 +2,11 @@
{% load taglinks %}
{% load static %}
<form method="POST" action="{% url "vote" toot.id %}">
<form method="POST" action="{% url "vote" toot.id %}"
ic-post-to="{% url "vote" toot.id %}"
ic-target="closest article"
ic-indicator="#poll-spinner-{{ toot.id }}"
ic-replace-target="true">
{% csrf_token %}
{% for option in toot.poll.options %}
<div class="field">
@ -24,4 +28,7 @@
</div>
{% endfor %}
<input type="submit" class="button is-primary" name="Vote" value="Vote">
<span id="poll-spinner-{{toot.id}}" class="fa fa-spinner fa-spin"
style="display:none"></span>
</form>

View File

@ -1635,4 +1635,10 @@ def vote(request, id):
values = [x for x in request.POST.getlist('poll-multiple')]
if values:
mastodon.poll_vote(poll.id, values)
if request.POST.get("ic-request"):
return render(request,
"main/toot_partial.html",
{"toot": mastodon.status(id) })
else:
return redirect("thread", id)