aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--apioforum/templates/config_thread.html19
-rw-r--r--apioforum/templates/view_thread.html2
-rw-r--r--apioforum/thread.py10
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 @@
<label for="polloptions">options (one per line)</label>
<textarea name="polloptions" id="polloptions"></textarea>
</fieldset>
- <p>important: once a poll is created, you will not be able to modify it except to delete it entirely</p>
+ <p>once a poll is created, you will not be able to modify it except to close it, or to delete it entirely</p>
<input type="submit" value="create">
</form>
{% else %}
-<h2>delete poll</h2>
-<p>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.</p>
+<h2>poll operations</h2>
+<p>there is already a poll attached to this thread.</p>
+{% if poll.closed %}
+<p>it has been closed already, and may not be reopened.</p>
+{% else %}
+<p>you can close it, which will prevent all further votes. you cannot reopen the poll after it has been closed.</p>
+<form action="{{url_for('thread.close_poll',thread_id=thread.id)}}" method="post">
+ <input type="submit" value="confirm: close poll">
+</form>
+{% endif %}
+
+<p>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.</p>
+
<form action="{{url_for('thread.delete_poll',thread_id=thread.id)}}" method="post">
<input type="submit" value="confirm: delete poll">
</form>
+
+
{% 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 @@
<fieldset>
<legend>poll: {{poll.title}}</legend>
{% if poll.closed %}
- <p>this poll has closed, and may not recieve further votes</p>
+ <p>this poll has been closed, and may not recieve further votes</p>
{% elif not has_permission(thread.forum, g.user, "p_vote") %}
<p>you don't have permission to vote on this poll</p>
{% 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,
+ )