diff --git a/rowers/templates/list_workouts.html b/rowers/templates/list_workouts.html index ea46495d..f576429f 100644 --- a/rowers/templates/list_workouts.html +++ b/rowers/templates/list_workouts.html @@ -280,7 +280,7 @@
{{ a.created }}: - {{ a.announcement|urlize }} + {{ a.announcement|urlshorten:20 }}
diff --git a/rowers/templatetags/rowerfilters.py b/rowers/templatetags/rowerfilters.py index 3bff8112..968814d6 100644 --- a/rowers/templatetags/rowerfilters.py +++ b/rowers/templatetags/rowerfilters.py @@ -31,8 +31,20 @@ from rowers.opaque import encoder import arrow +from django.utils.safestring import mark_safe +from django.utils.html import urlize as urlize_impl +from django.template.defaultfilters import stringfilter + from six import string_types +@register.filter(is_safe=True, needs_autoescape=True) +@stringfilter +def urlshorten(value, limit,autoescape=None): + return mark_safe( + urlize_impl( + value, trim_url_limit=int(limit), + nofollow=True, autoescape=autoescape).replace(' div > span { .site-announcement-box { padding: .2em .5em .2em 0em; + width: 100%; + max-width: 200px; } diff --git a/static/css/styles2.css b/static/css/styles2.css index d7d23e7d..becf3231 100644 --- a/static/css/styles2.css +++ b/static/css/styles2.css @@ -659,7 +659,8 @@ "ad content content" "ad footer footer" "ad footer footer" - } + } + nav ul { flex-direction: row; diff --git a/templates/newbase.html b/templates/newbase.html index 9a5c0549..e0789d5b 100644 --- a/templates/newbase.html +++ b/templates/newbase.html @@ -315,7 +315,7 @@
{{ a.created }}: - {{ a.announcement|urlize }} + {{ a.announcement|urlshorten:20 }}