mirror of https://gitlab.com/brutaldon/brutaldon
Polls work with intercooler
This commit is contained in:
parent
3439e8c22e
commit
5b7d4e0b68
|
@ -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>
|
||||
|
|
|
@ -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)
|
||||
return redirect("thread", id)
|
||||
|
||||
if request.POST.get("ic-request"):
|
||||
return render(request,
|
||||
"main/toot_partial.html",
|
||||
{"toot": mastodon.status(id) })
|
||||
else:
|
||||
return redirect("thread", id)
|
||||
|
|
Loading…
Reference in New Issue