From b965f1489d252a1055f9e34c15cd7a7c2cc16ebe Mon Sep 17 00:00:00 2001 From: vas3k Date: Wed, 5 Feb 2020 10:49:22 +0100 Subject: [PATCH] Better popup css --- boards/templatetags/text_filters.py | 11 +++++++++++ static/css/components.css | 6 ++++-- templates/board.html | 8 ++++---- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/boards/templatetags/text_filters.py b/boards/templatetags/text_filters.py index 2f3b383..dc3343d 100755 --- a/boards/templatetags/text_filters.py +++ b/boards/templatetags/text_filters.py @@ -26,6 +26,17 @@ def nl2br(text): return text +@register.filter(is_safe=True) +def nl2p(text): + """ + Wraps \n into

+ """ + if not text: + return "" + text = "

" + text.strip().replace("\n", "

") + "

" + return text + + @register.filter def cool_number(value, num_decimals=1): """ diff --git a/static/css/components.css b/static/css/components.css index d1cc853..68973d8 100644 --- a/static/css/components.css +++ b/static/css/components.css @@ -78,6 +78,7 @@ .landing-board-name { display: block; font-size: 160%; + line-height: 115%; margin: 10px 0 5px; font-weight: bold; } @@ -288,13 +289,14 @@ .article-tooltip-title { display: block; font-weight: bold; + font-size: 105%; } .article-tooltip-description { display: block; font-weight: normal; - font-size: 70%; - margin-top: 10px; + margin: 0; + font-size: 80%; overflow: hidden; } diff --git a/templates/board.html b/templates/board.html index 43291a6..16cf006 100644 --- a/templates/board.html +++ b/templates/board.html @@ -74,19 +74,19 @@ {{ article.title|striptags }} {% endif %} - {{ article.title|striptags|truncatechars:100 }} + {{ article.title|striptags|truncatechars:300 }} {% if article.description or article.summary %} {% if article.summary %} - {{ article.summary|striptags|nl2br|truncatechars:500|safe }} + {{ article.summary|striptags|escape|nl2p|truncatechars:600|safe }} {% else %} - {{ article.description|striptags|truncatechars:500 }} + {{ article.description|striptags|escape|nl2p|truncatechars:600|safe }} {% endif %} {% endif %} - {{ article.natural_created_at }} + {{ article.natural_created_at }} @ {{ article.domain }} {% endfor %}