diff options
author | ubq323 <ubq323> | 2021-06-06 16:54:26 +0000 |
---|---|---|
committer | ubq323 <ubq323> | 2021-06-06 16:54:26 +0000 |
commit | e2b8fc0582776a366def582d73b686c8968b44c3 (patch) | |
tree | 454bbc31040f1ca14a898d19bb7d749181dfff3f /apioforum/templates | |
parent | 6a2a05cd0e6aab46ca610dda3c2f408c6b9bd9e2 (diff) |
slightly improve css, add stubs of edit and delete, refactor some things
Diffstat (limited to 'apioforum/templates')
-rw-r--r-- | apioforum/templates/base.html | 4 | ||||
-rw-r--r-- | apioforum/templates/common.html | 24 | ||||
-rw-r--r-- | apioforum/templates/view_forum.html | 25 | ||||
-rw-r--r-- | apioforum/templates/view_thread.html | 14 |
4 files changed, 42 insertions, 25 deletions
diff --git a/apioforum/templates/base.html b/apioforum/templates/base.html index ef60264..626d88d 100644 --- a/apioforum/templates/base.html +++ b/apioforum/templates/base.html @@ -10,6 +10,9 @@ <main> <nav> <ul> + <li> + <span style="font-family: monospace;"><b>apio</b><i>forum</i>™</span> + </li> {% if g.user %} <li>{{ g.user }}</li> @@ -30,6 +33,7 @@ {%block content %}{% endblock %} </main> + <script>/* bees */</script> </body> </html> diff --git a/apioforum/templates/common.html b/apioforum/templates/common.html new file mode 100644 index 0000000..a547f73 --- /dev/null +++ b/apioforum/templates/common.html @@ -0,0 +1,24 @@ +{% macro disp_post(post, thread_id, buttons=False) %} +<div class="post"> + <div class="post-heading"> + <span class="post-heading-a"> + {{post.author}} @{{post.created}} #{{post.id}} + </span> + {% if buttons and post.author == g.user %} + <span class="post-heading-b"> + <a class="actionbutton" + href="{{url_for('thread.edit_post',post_id=post.id,thread_id=thread_id)}}"> + edit + </a> + <a class="actionbutton" + href="{{url_for('thread.delete_post',post_id=post.id,thread_id=thread_id)}}"> + delete + </a> + </span> + {% endif %} + </div> + <div class="post-content"> + {{ caller() }} + </div> +</div> +{% endmacro %} diff --git a/apioforum/templates/view_forum.html b/apioforum/templates/view_forum.html index 13e35a8..c7f88f1 100644 --- a/apioforum/templates/view_forum.html +++ b/apioforum/templates/view_forum.html @@ -3,22 +3,15 @@ {%block content%} <p>the</p> <a href="{{url_for('forum.create_thread')}}">create thread</a> -<table> - <tr> - <th>id</th> - <th>title</th> - <th>creator</th> - <th>created</th> - <th>updated</th> - </tr> +<div class="threadlistings"> {%for thread in threads%} -<tr> - <td>#{{thread.id}}</td> - <td><a href="{{url_for('thread.view_thread',thread_id=thread.id)}}">{{thread.title}}</a></td> - <td>{{thread.creator}}</td> - <td>{{thread.created}}</td> - <td>{{thread.updated}}</td> -</tr> +<div class="threadlisting"> + <div class="threadlisting-part threadlisting-part-title"><a href="{{url_for('thread.view_thread',thread_id=thread.id)}}">{{thread.title}}</a></div> + <div class="threadlisting-part threadlisting-part-id">#{{thread.id}}</div> + <div class="threadlisting-part threadlisting-part-creator">{{thread.creator}}</div> + <div class="threadlisting-part threadlisting-part-created">{{thread.created}}</div> + <div class="threadlisting-part threadlisting-part-updated">{{thread.updated}}</div> +</div> {%endfor%} -</table> +</div> {%endblock%} diff --git a/apioforum/templates/view_thread.html b/apioforum/templates/view_thread.html index d9efe86..acd062f 100644 --- a/apioforum/templates/view_thread.html +++ b/apioforum/templates/view_thread.html @@ -1,3 +1,4 @@ +{% from 'common.html' import disp_post %} {% extends 'base.html' %} {% block header %} <h1>{%block title %}{{thread.title}}{% endblock %}</h1> @@ -6,14 +7,9 @@ {%block content%} <div class="posts"> {% for post in posts %} - <div class="post"> - <div class="post_heading"> - {{post.author}} @{{post.created}} - </div> - <div class="post_content"> - {{rendered_posts[loop.index0] | safe}} - </div> - </div> + {% call disp_post(post, thread_id, True) %} + {{ rendered_posts[loop.index0] | safe}} + {% endcall %} {% endfor %} </div> {% if g.user %} @@ -22,6 +18,6 @@ <input type="submit" value="yes"> </form> {% else %} -<p>not logged in</p> +<p>please log in to reply to this thread</p> {% endif %} {% endblock %} |