From f119883d6773c1d887be78aef6d3566d620c012b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C4=93teris=20Caune?= Date: Mon, 11 Jun 2018 16:51:06 +0300 Subject: [PATCH] Allow check names to wrap at underscores --- hc/front/templatetags/hc_extras.py | 7 +++++++ templates/front/my_checks_desktop.html | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/hc/front/templatetags/hc_extras.py b/hc/front/templatetags/hc_extras.py index 3c2c0fbc..41634b58 100644 --- a/hc/front/templatetags/hc_extras.py +++ b/hc/front/templatetags/hc_extras.py @@ -81,3 +81,10 @@ def num_down_title(num_down): return "%d down – %s" % (num_down, settings.SITE_NAME) else: return settings.SITE_NAME + +@register.filter +def break_underscore(s): + if len(s) > 30: + s = s.replace("_", "_\u200b") + + return s diff --git a/templates/front/my_checks_desktop.html b/templates/front/my_checks_desktop.html index 9e0c7184..f2768646 100644 --- a/templates/front/my_checks_desktop.html +++ b/templates/front/my_checks_desktop.html @@ -59,7 +59,7 @@ data-tags="{{ check.tags }}" data-url="{% url 'hc-update-name' check.code %}" class="my-checks-name {% if not check.name %}unnamed{% endif %}"> -
{{ check.name|default:"unnamed" }}
+
{{ check.name|default:"unnamed"|break_underscore }}
{% for tag in check.tags_list %} {{ tag }} {% endfor %}