aboutsummaryrefslogtreecommitdiffstats
path: root/templates/poll.html.j2
diff options
context:
space:
mode:
authorJan Tuomi <jans.tuomi@gmail.com>2024-03-01 13:55:25 +0200
committerJan Tuomi <jan@jantuomi.fi>2024-12-21 19:43:13 +0200
commitef8c2c576043330a7a22d9549284003e57c284bb (patch)
tree187b131cb0c9441ce7dbfde7b65b6378ae216d98 /templates/poll.html.j2
parente348c0f2a6941810060b4add3dce7080175ad749 (diff)
Add possibility to manage own vote
Diffstat (limited to 'templates/poll.html.j2')
-rw-r--r--templates/poll.html.j223
1 files changed, 16 insertions, 7 deletions
diff --git a/templates/poll.html.j2 b/templates/poll.html.j2
index e0ede1f..1661b79 100644
--- a/templates/poll.html.j2
+++ b/templates/poll.html.j2
@@ -21,14 +21,23 @@
</form>
</div>
-<form action="/poll/{{ poll.id }}/vote" method="post">
- {% if display_mode == "table" %}
- {% include "poll_vote_table.html.j2" %}
- {% else %}
- {% include "poll_vote_list.html.j2" %}
- {% endif %}
-</form>
+
+{% if display_mode == "table" %}
+{% include "poll_vote_table.html.j2" %}
+{% else %}
+{% include "poll_vote_list.html.j2" %}
{% endif %}
+<script>
+ const query = new URLSearchParams(window.location.search);
+ const prefill_voter_name = query.get("prefill_voter_name");
+ if (prefill_voter_name !== null) {
+ document.querySelector("input[name=voter_name]").focus()
+ document.querySelector("input[name=voter_name]").select();
+ query.delete("prefill_voter_name");
+ history.replaceState(null, "", window.location.pathname + (query.toString() ? "?" + query.toString() : ""));
+ }
+ </script>
+{% endif %}
{% endblock %}