diff options
-rw-r--r-- | apioforum/templates/common.html | 6 | ||||
-rw-r--r-- | apioforum/templates/view_forum.html | 4 |
2 files changed, 7 insertions, 3 deletions
diff --git a/apioforum/templates/common.html b/apioforum/templates/common.html index 28598e7..9301a49 100644 --- a/apioforum/templates/common.html +++ b/apioforum/templates/common.html @@ -2,6 +2,10 @@ <a href="{{url_for('user.view_user',username=username)}}" class="username">{{username}}</a> {%- endmacro %} +{% macro post_url(post) -%} + {{url_for('thread.view_thread', thread_id=post.thread)}}#post_{{post.id}} +{%- endmacro %} + {% macro disp_post(post, buttons=False) %} <div class="post" id="post_{{post.id}}"> <div class="post-heading"> @@ -19,7 +23,7 @@ <a class="actionbutton" href="{{url_for('thread.delete_post',post_id=post.id)}}">delete</a> {% endif %} - <a class="post-anchor-link" href="{{url_for('thread.view_thread', thread_id=post.thread)}}#post_{{post.id}}">#{{post.id}}</a> + <a class="post-anchor-link" href="{{post_url(post)}}">#{{post.id}}</a> </span> </div> <div class="post-content"> diff --git a/apioforum/templates/view_forum.html b/apioforum/templates/view_forum.html index 99b8f0e..d1489c8 100644 --- a/apioforum/templates/view_forum.html +++ b/apioforum/templates/view_forum.html @@ -1,5 +1,5 @@ {% extends 'base.html' %} -{% from 'common.html' import ts, tag, disp_user %} +{% from 'common.html' import ts, tag, disp_user, post_url %} {% block header %}<h1>{% block title %}apioforum{%endblock%}</h1>{%endblock%} {%block nmcontent%} <main class="widemain"> @@ -38,7 +38,7 @@ {{ ts(preview_post[thread.id].created) }} </span> <span class="thread-preview-post"> - <a href="{{url_for('thread.view_thread', thread_id=thread.id)}}#post_{{preview_post[thread.id].id}}"> + <a href="{{post_url(preview_post[thread.id])}}"> {{ preview_post[thread.id].content[:500]|e }} </a> </span> |