By using this site, you agree to have cookies stored on your device, strictly for functional purposes, such as storing your session and preferences.

Dismiss

 post.html

View raw Download
text/html • 5.49 kiB
HTML document, ASCII text
        
            
1
<dl>
2
<dt>
3
<article class="card">
4
<section class="card-main">
5
<p class="post-details"><a href="/{{ post.owner.username }}" class="post-author">{{ post.owner.username }}</a> &bull; {{ post.date | strftime("%A, %e %B %Y, %H:%M:%S") }}</p>
6
{% if level %}
7
<h2><a href="{{ post.number }}">{{ post.subject }}</a> <span class="post-number">#{{ post.number }}</span></h2>
8
{% else %}
9
<h2>{{ post.subject }} <span class="post-number">#{{ post.number }}</span></h2>
10
{% endif %}
11
{% if not post.parent %}
12
<dialog id="add-label">
13
<article class="card">
14
<section class="card-main">
15
<form method="dialog" id="close-add-label"></form>
16
<form method="POST" action="{{ post.number }}/label">
17
<x-vbox>
18
<label>
19
{% trans %}Label to add:{% endtrans %}
20
<select name="label">
21
{% for label in repo_data.labels %}
22
<option value="{{ label.identifier }}">{{ label.name }}</option>
23
{% endfor %}
24
</select>
25
</label>
26
<x-buttonbox>
27
<button type="submit">{% trans %}Add label{% endtrans %}</button>
28
<button type="submit" form="close-add-label">{% trans %}Cancel{% endtrans %}</button>
29
</x-buttonbox>
30
</x-vbox>
31
</form>
32
</section>
33
</article>
34
</dialog>
35
36
<x-hbox class="post-labels box-center">
37
{% for label in post.labels %}
38
<a href="{{ post.number }}/remove-label?label={{ label.label.identifier }}" class="post-label {% if get_permission_level(logged_in_user, username, repository) >= 1 %}removable{% endif %}" style="background-color: {{ label.label.colour_hex }};">{{ label.label.name }}</a>
39
{% endfor %}
40
{% if get_permission_level(logged_in_user, username, repository) >= 1 %}
41
<button class="button-flat" onclick="document.getElementById('add-label').showModal();" title="{% trans %}Add a label{% endtrans %}">
42
<iconify-icon icon="mdi:plus"></iconify-icon>
43
</button>
44
{% endif %}
45
</x-hbox>
46
{% endif %}
47
<p>
48
{{ post.html | safe }}
49
</p>
50
{% if logged_in_user %}
51
<x-buttonbox>
52
<x-buttonbox class="box-center segmented">
53
<button onclick="vote({{ post.number }}, 1);" class="vote-button big-button" id="{{ post.number }}-voteup"><iconify-icon icon="mdi:arrow-up"></iconify-icon></button>
54
<span style="font-size: 1.5em;" class="vote-score" id="{{ post.number }}-vote">{{ post.voteSum }}</span>
55
<button onclick="vote({{ post.number }}, -1);" class="vote-button big-button" id="{{ post.number }}-votedown"><iconify-icon icon="mdi:arrow-down"></iconify-icon></button>
56
<script>vote({{ post.number }}, 0);</script>
57
</x-buttonbox>
58
{% if post.owner_name == logged_in_user %}
59
<a class="button" href="{{ post.number }}/edit">{% trans %}Edit{% endtrans %}</a>
60
{% endif %}
61
</x-buttonbox>
62
{% endif %}
63
</section>
64
</article>
65
</dt>
66
{% if logged_in_user %}
67
<dd>
68
<details class="reply-area">
69
<summary>{% trans %}Reply{% endtrans %}</summary>
70
71
<form method="POST" action="{{ post.number }}/reply">
72
<x-vbox>
73
<x-vbox class="nopad">
74
<label for="{{ post.number }}-subject">{% trans %}Subject{% endtrans %}</label>
75
<input id="{{ post.number }}-subject" name="subject" value="Re: {{ post.subject }}" required>
76
</x-vbox>
77
<textarea name="message" style="box-sizing: border-box;" rows="8" required></textarea>
78
<x-buttonbox>
79
<button type="submit">{% trans %}Submit{% endtrans %}</button>
80
</x-buttonbox>
81
</x-vbox>
82
</form>
83
</details>
84
</dd>
85
{% endif %}
86
{% set level = level + 1 %}
87
{% if level <= max_post_nesting %}
88
{% if post.children %}
89
{% for post in Post.query.filter_by(parent=post).order_by(Post.date) %}
90
<dd>{% include "post.html" %}</dd>
91
{% endfor %}
92
{% endif %}
93
{% elif post.children %}
94
<dd>
95
<a href="{{ post.number }}">{% trans %}Comments hidden; click to go deeper.{% endtrans %}</a>
96
</dd>
97
{% endif %}
98
</dl>
99