aboutsummaryrefslogtreecommitdiffhomepage
path: root/apioforum/templates/view_forum.html
blob: 649c87c4118f7eba0a8f84c8d60d4018c6544a59 (plain)
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
{% extends 'base.html' %}
{% from 'common.html' import ts, tag, disp_user, post_url, forum_breadcrumb, ab, vote_meter, pagination_nav %}
{% block header %}
<h1>{% block title %}{{forum.name}}{% endblock %} <span class="thing-id">#{{forum.id}}</span></h1>
{% if forum.id != 1 %}
	{{ forum_breadcrumb(forum) }}
{% endif %}
{%endblock%}

{%block content%}
{{forum.description|md|safe}} 

<hr/>
<div class="forum-info">
	{% if bureaucrats|length > 0 %}
		<p>
			bureaucrats in this forum:
			{% for b in bureaucrats %}
				{{disp_user(b)}}
			{% endfor %}
		</p>
	{% endif %}

	{% set role = get_user_role(forum.id, g.user) %}
	{% if role != "other" %}
	<p>your role in this forum: {{role}}</p>
	{% endif %}

	<p>available tags:
	{% for the_tag in avail_tags %}
	{{tag(the_tag)}}
	{% else %}
	<em>(none available)</em>
	{% endfor %}
	</p>
</div>

<p>
	{% if is_bureaucrat(forum.id, g.user) %}
		{{ab("forum settings",url_for('forum.edit_forum',forum_id=forum.id))}}
		{{ab("role/permission settings",url_for('forum.edit_roles',forum_id=forum.id))}}
		{{ab("assign roles",url_for('forum.view_user_role',forum_id=forum.id))}}
	{% endif %}
	{% if has_permission(forum.id, g.user, "p_create_subforum") %}
		{{ab("create subforum",url_for('forum.create_forum',forum_id=forum.id))}}
	{% endif %}
	{% if not is_bureaucrat(forum.id, g.user) and has_permission(forum.id, g.user, "p_approve") %}
		{{ab("approve users",url_for('forum.view_user_role',forum_id=forum.id))}}
	{% endif %}
</p>

{% if subforums %}
<h2>subforæ</h2>
<div class="forum-list">
	{% for subforum in subforums %}
		<div class="listing">
			<div class="listing-main">
				<div class="listing-title">
					<a href="{{url_for('forum.view_forum',forum_id=subforum.id)}}">
						{{- subforum.name -}}
					</a>
				</div>
			</div>
			<div class="listing-caption">
				{% if subforum.updated %}
					last activity {{ts(subforum.updated)}} ago
				{% else %}
					no threads
				{% endif %}
			</div>
		</div>
	{% endfor %}
</div>
{% endif %}

<h2>threads</h2>
<p>
{% if has_permission(forum.id, g.user, "p_create_threads") %}
<a class="actionbutton" href="{{url_for('forum.create_thread',forum_id=forum.id)}}">create new thread</a>
{% elif has_permission(forum.id, g.user, "p_create_threads", login_required=False) %}
please log in to create a new thread
{% else %}
you do not have permission to create threads in this forum
{% endif %}

{% if has_permission(forum.id, g.user, "p_view_threads", login_required=False) %}
{{ pagination_nav(page,max_pageno,'forum.view_forum',forum_id=forum.id) }}
<div class="thread-list">
	{%for thread in threads%}
		<div class="listing">
			<div class="listing-main">
				<div class="listing-title">
					<a href="{{url_for('thread.view_thread',thread_id=thread.id)}}">
						{{- thread.title -}}
					</a>
				</div>
				<div class="thread-listing-tags">
					{% for the_tag in thread_tags[thread.id] %}
						{{tag(the_tag)}}
					{% endfor %}
				</div>
				<div class="thread-listing-creation">
					<div class="thread-listing-creator">
						{{ disp_user(thread.creator) }} 
					</div>
					{{ ts(thread.created) }}
				</div>
			</div>
			{% if not thread.mrp_deleted %}
				<div class="listing-caption">
					{{ disp_user(thread.mrp_author) }}
					<span class="thread-preview-ts">
						{{ ts(thread.mrp_created) }}
					</span>
					<span class="thread-preview-post">
						<a href="{{post_jump(thread.mrp_id)}}">
							{{ thread.mrp_content[:500]|e }}
						</a>
					</span>
				</div>
			{% else %}
				<div class="listing-caption">
					<a class="thread-preview-post" 
					   href="{{post_jump(thread.mrp_id)}}">
						latest post
					</a>
				</div>
			{% endif %}
			{% if thread_polls[thread.id] %}
				<div class="thread-vote-summary">
					{{ vote_meter(thread_polls[thread.id]) }}
				</div>
			{% endif %}
		</div>
	{%endfor%}
</div>

	
{% else %}
<p>you do not have permission to view threads in this forum</p>
{% endif %}
{%endblock%}