From c3fe6d1f522ccc962ee414012219001aa480266e Mon Sep 17 00:00:00 2001 From: rebecca Date: Sun, 8 Nov 2026 15:41:53 +0000 Subject: ui for closing polls --- apioforum/templates/config_thread.html | 19 ++++++++++++++++--- apioforum/templates/view_thread.html | 2 +- apioforum/thread.py | 10 +++++++++- 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/apioforum/templates/config_thread.html b/apioforum/templates/config_thread.html index aa4575f..3e84f86 100644 --- a/apioforum/templates/config_thread.html +++ b/apioforum/templates/config_thread.html @@ -71,15 +71,28 @@ -

important: once a poll is created, you will not be able to modify it except to delete it entirely

+

once a poll is created, you will not be able to modify it except to close it, or to delete it entirely

{% else %} -

delete poll

-

there is already a poll attached to this thread. you can delete it, which will allow you to create a new one, but this will erase all existing votes and data for the current poll.

+

poll operations

+

there is already a poll attached to this thread.

+{% if poll.closed %} +

it has been closed already, and may not be reopened.

+{% else %} +

you can close it, which will prevent all further votes. you cannot reopen the poll after it has been closed.

+
+ +
+{% endif %} + +

you can {% if not poll.closed %}also{% endif %} delete it, which will allow you to create a new one, but this will erase all existing votes and data for the current poll.

+
+ + {% endif %} {% endif %} diff --git a/apioforum/templates/view_thread.html b/apioforum/templates/view_thread.html index 0dd2fde..c0ac772 100644 --- a/apioforum/templates/view_thread.html +++ b/apioforum/templates/view_thread.html @@ -83,7 +83,7 @@
poll: {{poll.title}} {% if poll.closed %} -

this poll has closed, and may not recieve further votes

+

this poll has been closed, and may not recieve further votes

{% elif not has_permission(thread.forum, g.user, "p_vote") %}

you don't have permission to vote on this poll

{% else %} diff --git a/apioforum/thread.py b/apioforum/thread.py index 6ef6122..d57e500 100644 --- a/apioforum/thread.py +++ b/apioforum/thread.py @@ -435,6 +435,9 @@ def config_thread(thread_id): thread = db.execute("select * from threads where id = ?",(thread_id,)).fetchone() thread_tags = [r['tag'] for r in db.execute("select tag from thread_tags where thread = ?",(thread_id,)).fetchall()] avail_tags = get_avail_tags(thread['forum']) + if thread['poll'] is not None: + poll = db.execute("select * from polls where id = ?",(thread['poll'],)).fetchone() + err = None if g.user is None: err = "you need to be logged in to do that" @@ -480,5 +483,10 @@ def config_thread(thread_id): else: return redirect(url_for("thread.view_thread",thread_id=thread_id)) - return render_template("config_thread.html", thread=thread,thread_tags=thread_tags,avail_tags=avail_tags) + return render_template("config_thread.html", + thread=thread, + thread_tags=thread_tags, + avail_tags=avail_tags, + poll=poll, + ) -- cgit v1.2.3