diff options
| author | raven <citrons@mondecitronne.com> | 2026-11-02 01:04:52 -0600 |
|---|---|---|
| committer | raven <citrons@mondecitronne.com> | 2026-11-02 01:07:26 -0600 |
| commit | 2a6c11a2ef112f590267af88c384b3ab91b02b33 (patch) | |
| tree | 29a6696fb9eec4763658ba1bf546d2615d386875 | |
| parent | 649ea02fa68034782ff3fa833850d8d4fd072d8f (diff) | |
limit size of posts transcluded for preview purposes
| -rw-r--r-- | apioforum/static/style.css | 5 | ||||
| -rw-r--r-- | apioforum/templates/common.html | 10 | ||||
| -rw-r--r-- | apioforum/templates/view_user.html | 2 |
3 files changed, 13 insertions, 4 deletions
diff --git a/apioforum/static/style.css b/apioforum/static/style.css index 8a30355..ba6543d 100644 --- a/apioforum/static/style.css +++ b/apioforum/static/style.css @@ -81,6 +81,11 @@ div.deleted-post { color: hsl(0,0%,80%); } +.preview-post { + overflow: hidden; + max-height: 303px; +} + @media (prefers-color-scheme: dark) { .deleted-post > .post-heading > * { color: hsl(0,0%,45%); diff --git a/apioforum/templates/common.html b/apioforum/templates/common.html index cac27ec..44c9036 100644 --- a/apioforum/templates/common.html +++ b/apioforum/templates/common.html @@ -2,7 +2,7 @@ <a href="{{url_for('user.view_user',username=username)}}" class="username">{{username}}</a> {%- endmacro %} -{% macro disp_post(post, buttons=False, forum=None, footer=None) %} +{% macro disp_post(post, buttons=False, forum=None, footer=None, preview = False) %} {% if not forum %} {% if post.forum %} {% set forum = post.forum %} @@ -15,7 +15,7 @@ {% elif post.deleted %} {{ hidden_post("this post never existed.", post) }} {% else %} -<div class="post {% if post.deleted %}deleted-post{% endif %}" id="post_{{post.id}}"> +<div class="post {% if post.deleted %}deleted-post{% endif %} {% if preview %}preview-post{% endif %}" id="post_{{post.id}}"> <div class="post-heading"> <span class="post-heading-a"> {{disp_user(post.author)}} @@ -60,7 +60,11 @@ </span> </div> <div class="post-content md"> - {{ post.content|md|safe }} + {% if not preview %} + {{ post.content|md|safe }} + {% else %} + {{ post.content[:2500]|md|safe }} + {% endif %} </div> {% if footer %} <div class="post-footer"> diff --git a/apioforum/templates/view_user.html b/apioforum/templates/view_user.html index 2235b5e..582f051 100644 --- a/apioforum/templates/view_user.html +++ b/apioforum/templates/view_user.html @@ -34,7 +34,7 @@ {{ pagination_nav(page,max_pageno,'user.view_user', username=user.username) }} <div class="user_posts"> {% for post in posts %} - {{ disp_post(post, False) }} + {{ disp_post(post, False, preview = True) }} {% endfor %} </div> {{ pagination_nav(page,max_pageno,'user.view_user', username=user.username,bottom=True) }} |
