Allow check names to wrap at underscores

This commit is contained in:
Pēteris Caune 2018-06-11 16:51:06 +03:00
parent 67363abe4f
commit f119883d67
No known key found for this signature in database
GPG Key ID: E28D7679E9A9EDE2
2 changed files with 8 additions and 1 deletions

View File

@ -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

View File

@ -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 %}">
<div>{{ check.name|default:"unnamed" }}</div>
<div>{{ check.name|default:"unnamed"|break_underscore }}</div>
{% for tag in check.tags_list %}
<span class="label label-tag">{{ tag }}</span>
{% endfor %}