summary refs log tree commit diff
path: root/templates/post.html
diff options
context:
space:
mode:
Diffstat (limited to 'templates/post.html')
-rw-r--r--templates/post.html38
1 files changed, 33 insertions, 5 deletions
diff --git a/templates/post.html b/templates/post.html
index d759da4..b585cab 100644
--- a/templates/post.html
+++ b/templates/post.html
@@ -1,6 +1,25 @@
 {% 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>
@@ -13,12 +32,21 @@
     <a href="{{ url_for('create', reply=post.id)}}"> Reply</a> ~
     <a href="{{ url_for('index') }}">Back to posts</a>
 </div>
-<hr>
-<h3> Replies to this</h3>
-<div class="post-replies">
+<button type="button" class="collapsible" onload="openNav()">Navigation</button>
+<div class="content">
+    <hr>
+    <h3>Previously to this </h3>
     <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 %}
+        <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 %}
\ No newline at end of file