/posts: word wrap long sources in sidebar.
* Don't truncate long sources in the sidebar on the post show page. Word wrap them instead. * Word wrap long external links in general (mainly links in dtext). * Turn sources into links on modqueue page.
This commit is contained in:
@@ -85,7 +85,7 @@ module ApplicationHelper
|
||||
text = text.truncate(truncate) if truncate
|
||||
|
||||
if url =~ %r!\Ahttps?://!i
|
||||
link_to text, url, rel: "noreferrer nofollow", **link_options
|
||||
link_to text, url, rel: "external noreferrer nofollow", **link_options
|
||||
else
|
||||
url
|
||||
end
|
||||
|
||||
@@ -61,9 +61,9 @@ module PostsHelper
|
||||
def post_source_tag(post)
|
||||
# Only allow http:// and https:// links. Disallow javascript: links.
|
||||
if post.source =~ %r!\Ahttps?://!i
|
||||
external_link_to(post.normalized_source, strip: :subdomain, truncate: 20) + " ".html_safe + link_to("»", post.source, rel: "noreferrer nofollow")
|
||||
external_link_to(post.normalized_source, strip: :subdomain) + " ".html_safe + link_to("»", post.source, rel: "external noreferrer nofollow")
|
||||
else
|
||||
truncate(post.source, length: 100)
|
||||
post.source
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user