From 7ab53804d10bf3e86f6b0c9e581310c0167f8272 Mon Sep 17 00:00:00 2001 From: rimu <3310831+rimu@users.noreply.github.com> Date: Fri, 6 Sep 2024 22:39:27 +1200 Subject: [PATCH] larger images and videos --- app/static/styles.css | 49 ++++++++++++++++++++ app/static/styles.scss | 49 ++++++++++++++++++++ app/templates/post/post_teaser/_article.html | 5 ++ app/templates/post/post_teaser/_image.html | 18 ++----- app/templates/post/post_teaser/_link.html | 10 ++-- app/templates/post/post_teaser/_video.html | 20 ++------ app/utils.py | 8 ++++ pyfedi.py | 3 +- 8 files changed, 126 insertions(+), 36 deletions(-) diff --git a/app/static/styles.css b/app/static/styles.css index e7afbf8f..24654673 100644 --- a/app/static/styles.css +++ b/app/static/styles.css @@ -867,6 +867,55 @@ div.navbar { padding-bottom: 32px; } +.post_teaser_article_preview { + position: relative; + max-height: 100px; + overflow: hidden; + padding-left: 3px; + padding-right: 3px; +} +.post_teaser_article_preview p { + margin: 0; + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 1; + /* Limits the text to a specific number of lines */ + line-clamp: 1; + overflow: hidden; + text-overflow: ellipsis; + white-space: normal; +} + +.post_teaser_image_preview { + text-align: center; + margin-top: 10px; + margin-bottom: 10px; +} +.post_teaser_image_preview img { + max-width: 100%; + padding-right: 4px; +} + +.post_teaser_video_preview { + text-align: center; + margin-top: 10px; + margin-bottom: 10px; + position: relative; +} +.post_teaser_video_preview img { + max-width: 100%; + padding-right: 4px; +} +.post_teaser_video_preview .fe-video { + position: absolute; + left: 43%; + top: 40%; + width: 13%; + font-size: 64px; + background-color: white; + opacity: 0.5; +} + .post_utilities_bar_wrapper { position: absolute; bottom: -7px; diff --git a/app/static/styles.scss b/app/static/styles.scss index b8329d6f..0312e724 100644 --- a/app/static/styles.scss +++ b/app/static/styles.scss @@ -459,6 +459,55 @@ div.navbar { padding-bottom: 32px; } +.post_teaser_article_preview { + position: relative; + max-height: 100px; + overflow: hidden; + padding-left: 3px; + padding-right: 3px; + + p { + margin: 0; + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 1; /* Limits the text to a specific number of lines */ + line-clamp: 1; + overflow: hidden; + text-overflow: ellipsis; + white-space: normal; + } +} + +.post_teaser_image_preview { + text-align: center; + margin-top: 10px; + margin-bottom: 10px; + img { + max-width: 100%; + padding-right: 4px; + } +} + +.post_teaser_video_preview { + text-align: center; + margin-top: 10px; + margin-bottom: 10px; + position: relative; + img { + max-width: 100%; + padding-right: 4px; + } + .fe-video { + position: absolute; + left: 43%; + top: 40%; + width: 13%; + font-size: 64px; + background-color: white; + opacity: 0.5; + } +} + .post_utilities_bar_wrapper { position: absolute; bottom: -7px; diff --git a/app/templates/post/post_teaser/_article.html b/app/templates/post/post_teaser/_article.html index ad309764..467c0f16 100644 --- a/app/templates/post/post_teaser/_article.html +++ b/app/templates/post/post_teaser/_article.html @@ -9,6 +9,11 @@
+ {% if post.body_html -%} + + {% endif -%} {% include "post/post_teaser/_utilities_bar.html" %} {% if post.image_id -%} diff --git a/app/templates/post/post_teaser/_image.html b/app/templates/post/post_teaser/_image.html index a3c9a19c..550195bd 100644 --- a/app/templates/post/post_teaser/_image.html +++ b/app/templates/post/post_teaser/_image.html @@ -12,19 +12,11 @@ - {% include "post/post_teaser/_utilities_bar.html" %} - -