related tags: strip http:// from artist urls.

This commit is contained in:
evazion
2018-10-25 23:38:24 -05:00
parent 705217d337
commit 77a576d5ed
2 changed files with 6 additions and 8 deletions

View File

@@ -107,12 +107,10 @@ module ApplicationHelper
time_tag(time.strftime("%Y-%m-%d %H:%M"), time)
end
def external_link_to(url, options = {})
if options[:truncate]
text = truncate(url, length: options[:truncate])
else
text = url
end
def external_link_to(url, truncate: nil, strip_scheme: false)
text = url
text = text.gsub(%r!\Ahttps?://!i, "") if strip_scheme
text = text.truncate(truncate) if truncate
if url =~ %r!\Ahttps?://!i
link_to text, url, {rel: :nofollow}