summary refs log tree commit diff
path: root/templates/post.html
blob: b585cab74173fc041dac9b0f93e5030c36bed2f7 (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
{% extends 'base.html' %}

{% block content %}
<script>
    function openNav() {
        console.log("hello run started")
        var coll = document.getElementsByClassName("collapsible");
        var i;

        for (i = 0; i < coll.length; i++) {
            console.log("run loop")
            coll[i].addEventListener("click", function () {
                this.classList.toggle("active");
                var content = this.nextElementSibling;
                if (content.style.display === "block") {
                    content.style.display = "none";
                } else {
                    content.style.display = "block";
                }
            });
        }
    } </script>
{% if post.parent != 0 %}
<a href="{{url_for('post', post_id=post.parent)}}"> Previous</a>
<hr>
{% endif %}
<h2>{{ post.title }}</h2>
<p>{{ post.created_at.strftime('%Y-%m-%d %H:%M') }}</p>
<p> Authour: {{post.authour.name}}</p>
<div>{{ post.content|markdown|safe }}</div>
<div class="post-actions">
    <a href="{{ url_for('create', reply=post.id)}}"> Reply</a> ~
    <a href="{{ url_for('index') }}">Back to posts</a>
</div>
<button type="button" class="collapsible" onload="openNav()">Navigation</button>
<div class="content">
    <hr>
    <h3>Previously to this </h3>
    <ul>
        <li> {% for p in previous %} <a href="{{ url_for('post', post_id=p.id) }}">{{ p.title }}</a> - {{
            p.created_at.strftime('%Y-%m-%d') }}</li> {% endfor %}
    </ul>
    <hr>
    <h3> Replies to this</h3>
    <div class="post-replies">
        <ul>
            <li> {% for reply in replies %} <a href="{{ url_for('post', post_id=reply.id) }}">{{ reply.title }}</a> - {{
                reply.created_at.strftime('%Y-%m-%d') }}</li> {% endfor %}
        </ul>
    </div>
</div>
{% endblock %}