1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
{% from 'common.html' import disp_post,tag,thread_breadcrumb,vote_meter,pagination_nav %}
{% extends 'base.html' %}
{% block header %}
<h1>{%block title %}{{thread.title}}{% endblock %} <span class="thing-id">#{{thread.id}}</span></h1>
{{ thread_breadcrumb(thread) }}
{% endblock %}
{%block content%}
{% if poll %}
<p>{{poll.title}}</p>
<ol>
{%for opt in poll.options%}
<li value="{{opt.option_idx}}"><i>{{opt.text}}</i>: {{opt.num or 0}} votes</li>
{%endfor%}
</ol>
{{ vote_meter(poll) }}
{% endif %}
<div class="thread-top-bar">
<span class="thread-top-bar-a">
{% if g.user == thread.creator or has_permission(thread.forum, g.user, "p_manage_threads") %}
<a class="actionbutton" href="{{url_for('thread.config_thread',thread_id=thread.id)}}">configure thread</a>
{% endif %}
{% if has_permission(thread.forum, g.user, "p_delete_posts") %}
<a class="actionbutton" href="{{url_for('thread.delete_thread',thread_id=thread.id)}}">delete thread</a>
{% endif %}
</span>
<span class="thread-top-bar-b">
{% for the_tag in tags %}
{{ tag(the_tag) }}
{% endfor %}
</span>
</div>
<div class="posts">
{% for post in posts %}
{% if votes[post.id] %}
{% set vote = votes[post.id] %}
{% set option_idx = vote.option_idx %}
{# this is bad but it's going to get refactored anyway #}
{% set footer %}
{% if vote.is_retraction %}
{% if not post.deleted %}
{{post.author}} retracted their vote
{% else %}
this post retracted a vote
{% endif %}
{% else %}
{% set option = poll.options[option_idx-1] %}
{% if vote.current %}
{{post.author}} votes for {{option_idx}}: {{option.text}}
{% else %}
{% if not post.deleted %}
{{post.author}} voted for {{option_idx}}: {{option.text}}, but later changed their vote
{% else %}
this post presented a vote that was later changed
{% endif %}
{% endif %}
{% endif %}
{% endset %}
{{ disp_post(post, forum=thread.forum, buttons=True, footer=footer) }}
{% else %}
{{ disp_post(post, forum=thread.forum, buttons=True) }}
{% endif %}
{% endfor %}
</div>
{{ pagination_nav(page,max_pageno,'thread.view_thread',thread_id=thread.id) }}
{% if g.user and has_permission(thread.forum, g.user, "p_reply_threads") %}
<form class="new-post" action="{{url_for('thread.create_post',thread_id=thread.id)}}" method="POST">
<textarea class="new-post-box" placeholder="your post here..." name="content"></textarea>
{% if poll and has_permission(thread.forum, g.user, "p_vote") %}
<fieldset>
<legend>poll: {{poll.title}}</legend>
<p>if you want, you can submit a vote along with this post. if you have previously voted
on this poll, your previous vote will be changed</p>
<input type="radio" id="dontvote" name="poll" value="dontvote" checked>
<label for="dontvote">do not submit any vote at the moment</label>
{% if has_voted %}
<br>
<input type="radio" id="retractvote" name="poll" value="retractvote">
<label for="retractvote">clear current vote</label>
{% endif %}
{% for opt in poll.options %}
<br>
<input type="radio" id="option_{{opt.option_idx}}" name="poll" value="{{opt.option_idx}}">
<label for="option_{{opt.option_idx}}">#{{opt.option_idx}} - {{opt.text}}</label>
{% endfor %}
</fieldset>
{% endif %}
<input type="submit" value="yes">
</form>
{% elif g.user %}
<p>you do not have permission to reply to this thread</p>
{% else %}
<p>please log in to reply to this thread</p>
{% endif %}
{% endblock %}
|