aboutsummaryrefslogtreecommitdiff
path: root/app/templates/threads/view.html
blob: f92ef3996e4ffe0b2a8ddb025f045f9cc996abec (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
{% extends "base.html" %}

{% block title %}
{{ thread.title }} - {{ _("Threads") }}
{% endblock %}

{% block content %}
	{% if current_user.is_authenticated %}
		{% if current_user in thread.watchers %}
			<form method="post" action="{{ thread.getUnsubscribeURL() }}" class="float-right">
				<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
				<input type="submit" class="btn btn-primary" value="Unsubscribe" />
			</form>
		{% else %}
			<form method="post" action="{{ thread.getSubscribeURL() }}" class="float-right">
				<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
				<input type="submit" class="btn btn-primary" value="Subscribe" />
			</form>
		{% endif %}
		{% if thread and thread.checkPerm(current_user, "LOCK_THREAD") %}
			{% if thread.locked %}
				<form method="post" action="{{ url_for('threads.set_lock', id=thread.id, lock=0) }}" class="float-right mr-2">
					<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
					<input type="submit" class="btn btn-secondary" value="{{ _('Unlock Thread') }}" />
				</form>
			{% else %}
				<form method="post" action="{{ url_for('threads.set_lock', id=thread.id, lock=1) }}" class="float-right mr-2">
					<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
					<input type="submit" class="btn btn-secondary" value="{{ _('Lock Thread') }}" />
				</form>
			{% endif %}
		{% endif %}
	{% endif %}

	{% if current_user == thread.author and thread.review %}
		<a class="btn btn-primary ml-1 float-right mr-2"
				href="{{ thread.review.package.getReviewURL() }}">
			<i class="fas fa-edit"></i>
			{{ _("Edit Review") }}
		</a>
	{% endif %}

	<h1>
		{% if thread.review %}
			{% if thread.review.recommends %}
				<i class="fas fa-thumbs-up mr-2" style="color:#6f6;"></i>
			{% else %}
				<i class="fas fa-thumbs-down mr-2" style="color:#f66;"></i>
			{% endif %}
		{% endif %}
		{% if thread.private %}&#x1f512; {% endif %}{{ thread.title }}
	</h1>

	{% if thread.package %}
		<p>
			Package: <a href="{{ thread.package.getDetailsURL() }}">{{ thread.package.title }}</a>
		</p>
	{% endif %}

	{% if thread.private %}
		<i>
			This thread is only visible to its creator, the package owner, and users of
			Editor rank or above.
		</i>
	{% endif %}

	{% from "macros/threads.html" import render_thread %}
	{{ render_thread(thread, current_user) }}
{% endblock %}