truncate urls on display on post replacements page #3322
This commit is contained in:
@@ -93,9 +93,15 @@ module ApplicationHelper
|
||||
time_tag(time.strftime("%Y-%m-%d %H:%M"), time)
|
||||
end
|
||||
|
||||
def external_link_to(url)
|
||||
def external_link_to(url, options = {})
|
||||
if options[:truncate]
|
||||
text = truncate(url, length: options[:truncate])
|
||||
else
|
||||
text = url
|
||||
end
|
||||
|
||||
if url =~ %r!\Ahttps?://!i
|
||||
link_to url, url, {rel: :nofollow}
|
||||
link_to text, url, {rel: :nofollow}
|
||||
else
|
||||
url
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user