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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
|
{% macro render_thread(thread, current_user) -%}
<ul class="comments mt-4 mb-0">
{% for r in thread.replies %}
<li class="row my-2 mx-0">
<div class="col-md-1 p-1">
<a href="{{ url_for('users.profile', username=r.author.username) }}">
<img class="img-responsive user-photo img-thumbnail img-thumbnail-1" src="{{ r.author.getProfilePicURL() }}">
</a>
</div>
<div class="col pr-0">
<div class="card">
<div class="card-header">
<a class="author {{ r.author.rank.name }}"
href="{{ url_for('users.profile', username=r.author.username) }}">
{{ r.author.display_name }}
</a>
<a name="reply-{{ r.id }}" class="text-muted float-right"
href="{{ url_for('threads.view', id=thread.id) }}#reply-{{ r.id }}">
{{ r.created_at | datetime }}
</a>
</div>
<div class="card-body">
{% if r.checkPerm(current_user, "DELETE_REPLY") %}
<a class="float-right btn btn-secondary btn-sm ml-2"
href="{{ url_for('threads.delete_reply', id=thread.id, reply=r.id) }}">
<i class="fas fa-trash"></i>
</a>
{% endif %}
{% if current_user == thread.author and thread.review and thread.replies[0] == r %}
<a class="float-right btn btn-primary btn-sm ml-2"
href="{{ thread.review.package.getReviewURL() }}">
<i class="fas fa-edit"></i>
</a>
{% elif r.checkPerm(current_user, "EDIT_REPLY") %}
<a class="float-right btn btn-primary btn-sm ml-2"
href="{{ url_for('threads.edit_reply', id=thread.id, reply=r.id) }}">
<i class="fas fa-edit"></i>
</a>
{% endif %}
{{ r.comment | markdown }}
</div>
</div>
</div>
</li>
{% endfor %}
</ul>
{% if thread.locked %}
<p class="my-0 py-4 text-center">
<i class="fas fa-lock mr-3"></i>
{{ _("This thread has been locked by a moderator.") }}
</p>
{% endif %}
{% if current_user.is_authenticated %}
<div class="row mt-0 mb-4 comments mx-0">
<div class="col-md-1 p-1">
<img class="img-responsive user-photo img-thumbnail img-thumbnail-1" src="{{ current_user.getProfilePicURL() }}">
</div>
<div class="col">
<div class="card">
<div class="card-header {{ current_user.rank.name }}">
{{ current_user.display_name }}
<a name="reply"></a>
</div>
{% if not current_user.canCommentRL() %}
<div class="card-body">
<textarea class="form-control" readonly disabled>{{ _("Please wait before commenting again.") }}</textarea><br />
<input class="btn btn-primary" type="submit" disabled value="Comment" />
</div>
{% elif not thread.checkPerm(current_user, "COMMENT_THREAD") %}
<div class="card-body">
{% if thread.locked %}
<textarea class="form-control" readonly disabled>{{ _("This thread has been locked.") }}</textarea><br />
{% else %}
<textarea class="form-control" readonly disabled>{{ _("You don't have permission to post.") }}</textarea><br />
{% endif %}
<input class="btn btn-primary" type="submit" disabled value="Comment" />
</div>
{% else %}
<form method="post" action="{{ url_for('threads.view', id=thread.id)}}" class="card-body">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
<textarea class="form-control markdown" required maxlength=2000 name="comment"></textarea><br />
<input class="btn btn-primary" type="submit" value="Comment" />
</form>
{% endif %}
</div>
</div>
</div>
{% endif %}
{% endmacro %}
{% macro render_threadlist(threads, compact=False) -%}
{% for t in threads %}
<a class="list-group-item list-group-item-action"
href="{{ url_for('threads.view', id=t.id) }}">
{% if compact %}
{% if t.private %}🔒 {% endif %}
<strong>{{ t.title }}</strong>
by {{ t.author.display_name }}
{% else %}
<div class="row">
<div class="col-sm">
<span class="mr-3">
{% if not t.review and t.private %}
<i class="fas fa-lock" style="color:#ffac33;"></i>
{% elif not t.review %}
<i class="fas fa-comment-alt" style="color:#666;"></i>
{% elif t.review.recommends %}
<i class="fas fa-thumbs-up" style="color:#6f6;"></i>
{% else %}
<i class="fas fa-thumbs-down" style="color:#f66;"></i>
{% endif %}
</span>
<strong>{{ t.title }}</strong>
by {{ t.author.display_name }}
</div>
<div class="col-sm">
{% if t.package %}
{{ _("%(title)s by %(author)s",
title="<b>" | safe + t.package.title + "</b>" | safe,
author=t.package.author.display_name) }}
{% endif %}
</div>
<div class="col-sm-auto text-muted text-right">
{{ t.created_at | datetime }}
</div>
</div>
{% endif %}
</a>
{% else %}
<p class="list-group-item"><i>No threads found</i></p>
{% endfor %}
{% endmacro %}
|